Skip to main content

IndexDsl

cm_index

Create a table view for the index page with pagination.

Parameters

NameTypeDescription
display_nameStringThe display name of the page.
page_titleStringThe title of the page. If not provided, defaults to the formatted model name pluralized.
page_descriptionStringThe description of the page.
partialStringThe partial path to render for the page.
view_typeSymbolThe 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 TypeUsage
:tableDefault table layout with pagination.
:cardCard-style layout (good for media-rich models).
:kanbanKanban-style board grouped by a status or field.

Notes

  • cm_index must wrap all columns and filters meant for the index view.
  • If no page_title is given, it automatically becomes the pluralized resource name.
  • To build a Kanban index, use view_type: :kanban together with a kanban_view declaration.

Method Signature

cm_index(display_name: nil, page_title: nil, page_description: nil, partial: nil, view_type: :table)