Skip to content

Commit

Permalink
docs: Add documentation to index page surrounding bulk actions
Browse files Browse the repository at this point in the history
Closes #183
  • Loading branch information
josegonzalez committed Jun 27, 2017
1 parent 4bf2572 commit af6be60
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 af6be60

Please sign in to comment.