Class: FoxTail::Accordion::ItemComponent
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- FoxTail::Accordion::ItemComponent
- Includes:
- Concerns::Identifiable
- Defined in:
- app/components/fox_tail/accordion/item_component.rb
Instance Attribute Summary collapse
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #before_render ⇒ Object
- #body_id ⇒ Object
- #call ⇒ Object
-
#initialize(id_or_title, title_or_attributes = {}, html_attributes = {}) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
- #trigger_id ⇒ Object
Constructor Details
#initialize(id_or_title, title_or_attributes = {}, html_attributes = {}) ⇒ ItemComponent
Returns a new instance of ItemComponent.
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/components/fox_tail/accordion/item_component.rb', line 64 def initialize(id_or_title, title_or_attributes = {}, html_attributes = {}) if title_or_attributes.is_a? Hash html_attributes = title_or_attributes title_or_attributes = id_or_title else __id_argument_deprecated_warning html_attributes[:id] = id_or_title end @title = title_or_attributes super(html_attributes) end |
Instance Attribute Details
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'app/components/fox_tail/accordion/item_component.rb', line 6 def title @title end |
Instance Method Details
#before_render ⇒ Object
85 86 87 88 89 90 |
# File 'app/components/fox_tail/accordion/item_component.rb', line 85 def before_render super generate_unique_id html_attributes[:class] = classnames theme.apply(:root, self), html_class end |
#body_id ⇒ Object
77 78 79 |
# File 'app/components/fox_tail/accordion/item_component.rb', line 77 def body_id :"#{id}_body" end |
#call ⇒ Object
92 93 94 95 96 97 |
# File 'app/components/fox_tail/accordion/item_component.rb', line 92 def call content_tag :div, html_attributes do concat render_header concat render_body end end |
#trigger_id ⇒ Object
81 82 83 |
# File 'app/components/fox_tail/accordion/item_component.rb', line 81 def trigger_id :"#{id}_trigger" end |