Module: Katalyst::Tables::Selectable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/components/concerns/katalyst/tables/selectable.rb,
app/components/katalyst/tables/selectable/form_component.rb
Overview
Adds checkbox selection to a table. See [documentation](/docs/selectable.md) for more details.
Defined Under Namespace
Classes: FormComponent
Constant Summary collapse
- FORM_CONTROLLER =
"tables--selection--form"
- TABLE_CONTROLLER =
"tables--selection--table"
- ITEM_CONTROLLER =
"tables--selection--item"
Class Method Summary collapse
-
.default_form_id(collection) ⇒ Object
Returns the default dom id for the selection form, uses the table’s default id with ‘_selection’ appended.
Instance Method Summary collapse
-
#select(params: { id: record&.id }, form_id: Selectable.default_form_id(collection)) ⇒ void
Adds the selection column to the table.
Class Method Details
.default_form_id(collection) ⇒ Object
Returns the default dom id for the selection form, uses the table’s default id with ‘_selection’ appended.
16 17 18 |
# File 'app/components/concerns/katalyst/tables/selectable.rb', line 16 def self.default_form_id(collection) "#{Identifiable::Defaults.default_table_id(collection)}_selection_form" end |
Instance Method Details
#select(params: { id: record&.id }, form_id: Selectable.default_form_id(collection)) ⇒ void
This method returns an undefined value.
Adds the selection column to the table
30 31 32 33 34 35 36 |
# File 'app/components/concerns/katalyst/tables/selectable.rb', line 30 def select(params: { id: record&.id }, form_id: Selectable.default_form_id(collection), **, &) update_html_attributes(**table_selection_attributes(form_id:)) if header? with_cell(Cells::SelectComponent.new( collection:, row:, column: :_select, record:, label: "", heading: false, params:, form_id:, **, ), &) end |