IndexDsl
cm_index
Create a table view for the index page with pagination.
Parameters
| Name | Type | Description |
|---|---|---|
display_name | String | The display name of the page. |
page_title | String | The title of the page. If not provided, defaults to the formatted model name pluralized. |
page_description | String | The description of the page. |
partial | String | The partial path to render for the page. |
view_type | Symbol | The type of index view. Allowed values: :table, :card, :kanban. Default: :table. |
Example — Basic index page
cm_index do
page_title 'Post'
column :title
column :created_at, field_type: :date, format: '%d %b, %Y'
column :updated_at, field_type: :date, format: '%d %b, %Y', header: 'Last Updated At'
end
Display Types Supported
| View Type | Usage |
|---|---|
:table | Default table layout with pagination. |
:card | Card-style layout (good for media-rich models). |
:kanban | Kanban-style board grouped by a status or field. |
Notes
cm_indexmust wrap all columns and filters meant for the index view.- If no
page_titleis given, it automatically becomes the pluralized resource name. - To build a Kanban index, use
view_type: :kanbantogether with akanban_viewdeclaration.
Method Signature
cm_index(display_name: nil, page_title: nil, page_description: nil, partial: nil, view_type: :table)