Class: Arara::DataTableHeaderCellComponent

Inherits:
ActionView::Component::Base
  • Object
show all
Includes:
BaseComponent
Defined in:
app/components/arara/data_table_header_cell_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(numeric: false, **kw) ⇒ DataTableHeaderCellComponent

Returns a new instance of DataTableHeaderCellComponent.



8
9
10
11
# File 'app/components/arara/data_table_header_cell_component.rb', line 8

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

Instance Attribute Details

#numericObject (readonly)

Returns the value of attribute numeric.



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

def numeric
  @numeric
end

Instance Method Details

#default_html_classObject



13
14
15
16
# File 'app/components/arara/data_table_header_cell_component.rb', line 13

def default_html_class
  return "mdc-data-table__header-cell mdc-data-table__header-cell--numeric" if numeric
  "mdc-data-table__header-cell"
end

#html_optionsObject



18
19
20
21
22
# File 'app/components/arara/data_table_header_cell_component.rb', line 18

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