Class: RubyUI::BulkActionTableCheckboxCell
- Defined in:
- lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table_checkbox_cell.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(item_id:, controller_name: "ruby-ui--bulk-action-table", **user_attrs) ⇒ BulkActionTableCheckboxCell
constructor
A new instance of BulkActionTableCheckboxCell.
- #view_template ⇒ Object
Constructor Details
#initialize(item_id:, controller_name: "ruby-ui--bulk-action-table", **user_attrs) ⇒ BulkActionTableCheckboxCell
Returns a new instance of BulkActionTableCheckboxCell.
5 6 7 8 9 |
# File 'lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table_checkbox_cell.rb', line 5 def initialize(item_id:, controller_name: "ruby-ui--bulk-action-table", **user_attrs) @item_id = item_id @controller_name = controller_name super(**user_attrs) end |
Instance Method Details
#view_template ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table_checkbox_cell.rb', line 11 def view_template td(**attrs) do div( class: "inline-flex items-center justify-center p-2 -m-2 cursor-pointer", data: { action: "click->#{@controller_name}#stopPropagation" } ) do input( type: "checkbox", role: "checkbox", value: @item_id, data: { "#{@controller_name}_target": "itemCheckbox", item_id: @item_id, action: "change->#{@controller_name}#updateSelection" }, class: "size-4 rounded border-border/80 text-primary focus:ring-primary/30 focus:ring-offset-0 cursor-pointer transition-colors" ) end end end |