Skip to content

Commit

Permalink
Merge pull request #188 from FriendsOfCake/bulk-actions-docs
Browse files Browse the repository at this point in the history
docs: Add documentation to index page surrounding bulk actions
  • Loading branch information
josegonzalez authored Jun 27, 2017
2 parents 4bf2572 + af6be60 commit 140769e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
27 changes: 27 additions & 0 deletions docs/_partials/pages/index/bulk-actions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Bulk Actions
------------

The Crud plugin provides bulk actions which can be easily used with crud view.

To set up crud action in controller do something like this in initialize method.

.. code-block:: php
$this->loadComponent('Crud.Crud', [
'actions' => [
'deleteAll' => [
'className' => 'Crud.Bulk/Delete',
],
]
]);
Once a bulk action has been mapped, the ``scaffold.bulk_actions`` configuration
key can be specified. The ``scaffold.bulk_actions`` configuration key takes an
array of key/value pairs, where the key is the url and the value is the title.

.. code-block:: php
$action = $this->Crud->action();
$action->config('scaffold.bulk_actions', [
Router::url(['action' => 'deleteAll']) => __('Delete records'),
]);
25 changes: 1 addition & 24 deletions docs/basic-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -491,30 +491,7 @@ alter the ``contain()`` list for the pagination query:
return $this->Crud->execute();
}
Bulk Actions
------------

The Crud plugin provides bulk actions which can be easily used with crud view.

To set up crud action in controller do something like this in initialize method.

.. code-block:: php
$this->loadComponent('Crud.Crud', [
'actions' => [
'deleteAll' => [
'className' => 'Crud.Bulk/Delete',
],
]
]);
Then you need to configure scaffold to display select with actions.

.. code-block:: php
$action->config('scaffold.bulk_actions', [
Router::url(['action' => 'deleteAll']) => __('Delete records'),
]);
.. include:: /_partials/pages/index/bulk-actions.rst

Going Forward
-------------
Expand Down
1 change: 1 addition & 0 deletions docs/index-pages/customizing-the-index-page.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ in scope. To limit the fields used, simply specify an array of fields:
.. include:: /_partials/fields/formatter-element.rst

.. include:: /_partials/pages/index/buttons.rst
.. include:: /_partials/pages/index/bulk-actions.rst
.. include:: /_partials/pages/index/finder-scopes.rst
.. include:: /_partials/pages/index/filters.rst
.. include:: /_partials/pages/index/multiple-pages.rst
Expand Down

0 comments on commit 140769e

Please sign in to comment.