Class: Arara::DataTableHeaderCheckboxComponent

Inherits:
ActionView::Component::Base
  • Object
show all
Includes:
BaseComponent
Defined in:
app/components/arara/data_table_header_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, label:, **kw) ⇒ DataTableHeaderCheckboxComponent

Returns a new instance of DataTableHeaderCheckboxComponent.



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

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

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



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

def label
  @label
end

#selectedObject (readonly)

Returns the value of attribute selected.



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

def selected
  @selected
end

Instance Method Details

#checkbox_classObject



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

def checkbox_class
  return "mdc-checkbox mdc-data-table__header-row-checkbox mdc-checkbox--selected" if selected
  "mdc-checkbox mdc-data-table__header-row-checkbox"
end

#default_html_classObject



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

def default_html_class
  "mdc-data-table__header-cell mdc-data-table__header-cell--checkbox"
end

#html_optionsObject



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

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