Class: Arara::DataTableBodyRowComponent
- Inherits:
-
ActionView::Component::Base
- Object
- ActionView::Component::Base
- Arara::DataTableBodyRowComponent
- Includes:
- BaseComponent
- Defined in:
- app/components/arara/data_table_body_row_component.rb
Instance Attribute Summary collapse
-
#selected ⇒ Object
readonly
Returns the value of attribute selected.
Instance Method Summary collapse
- #default_html_class ⇒ Object
- #html_options ⇒ Object
-
#initialize(selected: false, **kw) ⇒ DataTableBodyRowComponent
constructor
A new instance of DataTableBodyRowComponent.
Methods included from BaseComponent
#default_data_controller, #default_html_tag, #html_class, #html_content, #html_data, #html_tag, included
Constructor Details
#initialize(selected: false, **kw) ⇒ DataTableBodyRowComponent
Returns a new instance of DataTableBodyRowComponent.
8 9 10 11 |
# File 'app/components/arara/data_table_body_row_component.rb', line 8 def initialize(selected: false, **kw) super(tag: "tr", **kw) @selected = selected end |
Instance Attribute Details
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
4 5 6 |
# File 'app/components/arara/data_table_body_row_component.rb', line 4 def selected @selected end |
Instance Method Details
#default_html_class ⇒ Object
13 14 15 16 |
# File 'app/components/arara/data_table_body_row_component.rb', line 13 def default_html_class return "mdc-data-table__row mdc-data-table__row--selected" if selected "mdc-data-table__row" end |
#html_options ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/components/arara/data_table_body_row_component.rb', line 18 def opts = super if selected opts[:aria] = {} unless opts.has_key?(:aria) opts[:aria][:selected] = true end opts end |