Class: Arara::DataTableComponent
- Inherits:
-
ActionView::Component::Base
- Object
- ActionView::Component::Base
- Arara::DataTableComponent
show all
- Includes:
- BaseComponent
- Defined in:
- app/components/arara/data_table_component.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#default_html_tag, #html_class, #html_content, #html_data, #html_options, #html_tag, included
Constructor Details
Returns a new instance of DataTableComponent.
8
9
10
11
|
# File 'app/components/arara/data_table_component.rb', line 8
def initialize(label: nil, **kw)
super(tag: "div", **kw)
@label = label
end
|
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
4
5
6
|
# File 'app/components/arara/data_table_component.rb', line 4
def label
@label
end
|
Instance Method Details
#default_data_controller ⇒ Object
17
18
19
|
# File 'app/components/arara/data_table_component.rb', line 17
def default_data_controller
"mdc-data-table"
end
|
#default_html_class ⇒ Object
13
14
15
|
# File 'app/components/arara/data_table_component.rb', line 13
def default_html_class
"mdc-data-table"
end
|
#table_options ⇒ Object
25
26
27
28
29
30
31
32
33
34
|
# File 'app/components/arara/data_table_component.rb', line 25
def table_options
opts = {
class: "mdc-data-table__table"
}
unless label.empty?
opts[:aria] ||= {}
opts[:aria][:label] = label
end
opts
end
|
#table_tag ⇒ Object
21
22
23
|
# File 'app/components/arara/data_table_component.rb', line 21
def table_tag
"table"
end
|