Action availability and toolbar¶
Enabling and disabling actions¶
By default a resource exposes index, show, new/create, edit/update, and destroy.
The actions declaration narrows that set. A disabled action loses its route
(requests 404), its row controls, and its form links.
1 2 3 4 5 | |
The action names are index, show, new (covers create), edit (covers
update), and destroy. Disabling an action also hides its buttons, since the
buttons are gated by the same availability check the routes use.
Default sort order¶
sort-order sets the ordering applied when the request carries no sort
parameter. A user clicking a sortable column header still overrides it.
1 | |
dir is asc (default) or desc. The column need not be a displayed sortable
column; this is the resource's baseline ordering.
Disabling filters and batch actions¶
Filters and batch actions are on by default. Turn either off per resource with a
register option:
1 | |
With filters => False the filter panel, chips, and filter query handling are
gone. With batch-actions => False the selection checkboxes, select-all, and the
batch toolbar are gone.
Toolbar action items¶
action-item adds a button to the page toolbar (the top of the index, above the
show page). The block returns the button's HTML and receives the controller and,
on a show page, the record. It can carry a plain href or an HTMX action.
1 2 3 4 5 6 7 | |
only and except restrict the actions an item appears on (index, show).
Pass if-can to gate the item on an authorization ability; it is hidden when the
policy forbids that ability.