Class: Arara::CheckboxComponent
- Inherits:
-
ActionView::Component::Base
- Object
- ActionView::Component::Base
- Arara::CheckboxComponent
- Includes:
- BaseComponent
- Defined in:
- app/components/arara/checkbox_component.rb
Instance Attribute Summary collapse
-
#checked ⇒ Object
readonly
Returns the value of attribute checked.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#indeterminate ⇒ Object
readonly
Returns the value of attribute indeterminate.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #default_html_class ⇒ Object
- #html_data ⇒ Object
-
#initialize(id:, name:, value: 1, checked: false, indeterminate: false, **kw) ⇒ CheckboxComponent
constructor
A new instance of CheckboxComponent.
Methods included from BaseComponent
#default_data_controller, #default_html_tag, #html_class, #html_content, #html_options, #html_tag, included
Constructor Details
#initialize(id:, name:, value: 1, checked: false, indeterminate: false, **kw) ⇒ CheckboxComponent
Returns a new instance of CheckboxComponent.
6 7 8 9 10 11 12 13 |
# File 'app/components/arara/checkbox_component.rb', line 6 def initialize(id:, name:, value: 1, checked: false, indeterminate: false, **kw) super(tag: "div", **kw) @checked = checked @indeterminate = indeterminate @id = id @name = name @value = value end |
Instance Attribute Details
#checked ⇒ Object (readonly)
Returns the value of attribute checked.
4 5 6 |
# File 'app/components/arara/checkbox_component.rb', line 4 def checked @checked end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'app/components/arara/checkbox_component.rb', line 4 def id @id end |
#indeterminate ⇒ Object (readonly)
Returns the value of attribute indeterminate.
4 5 6 |
# File 'app/components/arara/checkbox_component.rb', line 4 def indeterminate @indeterminate end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'app/components/arara/checkbox_component.rb', line 4 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'app/components/arara/checkbox_component.rb', line 4 def value @value end |
Instance Method Details
#default_html_class ⇒ Object
21 22 23 |
# File 'app/components/arara/checkbox_component.rb', line 21 def default_html_class 'mdc-checkbox' end |
#html_data ⇒ Object
15 16 17 18 19 |
# File 'app/components/arara/checkbox_component.rb', line 15 def html_data data = super data.merge!(checked: checked, indeterminate: indeterminate) data end |