Class: Arara::DataTableBodyCheckboxComponent

Inherits:
ActionView::Component::Base
  • Object
show all
Includes:
BaseComponent
Defined in:
app/components/arara/data_table_body_checkbox_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BaseComponent

#default_data_controller, #default_html_tag, #html_class, #html_content, #html_data, #html_tag, included

Constructor Details

#initialize(selected: false, id:, **kw) ⇒ DataTableBodyCheckboxComponent

Returns a new instance of DataTableBodyCheckboxComponent.



6
7
8
9
10
# File 'app/components/arara/data_table_body_checkbox_component.rb', line 6

def initialize(selected: false, id:, **kw)
  super(tag: "td", **kw)
  @selected = selected
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'app/components/arara/data_table_body_checkbox_component.rb', line 4

def id
  @id
end

#selectedObject (readonly)

Returns the value of attribute selected.



4
5
6
# File 'app/components/arara/data_table_body_checkbox_component.rb', line 4

def selected
  @selected
end

Instance Method Details

#checkbox_classObject



20
21
22
23
# File 'app/components/arara/data_table_body_checkbox_component.rb', line 20

def checkbox_class
  return "mdc-checkbox mdc-data-table__row-checkbox mdc-checkbox--selected" if selected
  "mdc-checkbox mdc-data-table__row-checkbox"
end

#default_html_classObject



12
13
14
# File 'app/components/arara/data_table_body_checkbox_component.rb', line 12

def default_html_class
  "mdc-data-table__cell mdc-data-table__cell--checkbox"
end

#html_optionsObject



16
17
18
# File 'app/components/arara/data_table_body_checkbox_component.rb', line 16

def html_options
  super.merge!({role: "columnheader", scope: "col"})
end