定制 owl/list-delete 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

owl/list-delete

Composer 安装命令:

composer require owl/list-delete

包简介

List delete behavior for OctoberCMS.

README 文档

README

List delete behavior for OctoberCMS.

Packagist

Installation

To install the List Delete behavior, add the following to your plugin's composer.json file.

"require": {
    "owl/list-delete": "~1.0@dev"
}

Next, implement the behavior in your controllers...

public $implement = [
    'Backend.Behaviors.FormController',
    'Backend.Behaviors.ListController',
    'Owl.Behaviors.ListDelete.Behavior',    // <-- add this line
];

Then enable checkboxes in your config_list.yaml file...

showCheckboxes: true    # <-- uncomment this line

And lastly, add a button to your _list_toolbar.htm file...

<button
    class="btn btn-default oc-icon-trash-o"
    disabled="disabled"
    onclick="$(this).data('request-data', {
        checked: $('.control-list').listWidget('getChecked')
    })"
    data-request="onDelete"
    data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
    data-trigger-action="enable"
    data-trigger=".control-list input[type=checkbox]"
    data-trigger-condition="checked"
    data-request-success="$(this).prop('disabled', false)"
    data-stripe-load-indicator>
    <?= e(trans('backend::lang.list.delete_selected')) ?>
</button>

Overriding default actions

If you need to perform additional delete logic, simply add the following method to your controller.

public function overrideListDelete($record)
{
    $record->delete();
    // do whatever else you need to do
}

To override what should happen after your records are deleted, add the following method to your controller.

public function afterListDelete()
{
    Flash::success('Things were deleted!');
}

By default, the list will be refreshed after a delete has occured. If you'd like to override this behavior, add the following method to your controller.

public function overrideListRefresh()
{
    // do stuff here
}

统计信息

  • 总下载量: 23.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-09