Class: FoxTail::CollapsibleTriggerComponent
- Inherits:
-
TriggerBaseComponent
- Object
- ViewComponent::Base
- Base
- BaseComponent
- TriggerBaseComponent
- FoxTail::CollapsibleTriggerComponent
- Defined in:
- app/components/fox_tail/collapsible_trigger_component.rb
Defined Under Namespace
Classes: StimulusController
Instance Attribute Summary
Attributes inherited from TriggerBaseComponent
Attributes inherited from BaseComponent
Instance Method Summary collapse
Methods inherited from TriggerBaseComponent
#block?, #call, #initialize, #render?
Methods inherited from BaseComponent
classname_merger, #initialize, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class
Methods inherited from Base
Constructor Details
This class inherits a constructor from FoxTail::TriggerBaseComponent
Instance Method Details
#before_render ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/components/fox_tail/collapsible_trigger_component.rb', line 10 def before_render super html_attributes[:class] = classnames theme.classname("root.base"), open? && theme.classname("root.expanded"), !open? && theme.classname("root.collapsed"), html_class end |
#stimulus_controller_options ⇒ Object
19 20 21 22 23 |
# File 'app/components/fox_tail/collapsible_trigger_component.rb', line 19 def super.merge open: open?, collapsed_classes: theme.classname("root.collapsed"), expanded_classes: theme.classname("root.expanded") end |
#trigger_type ⇒ Object
6 7 8 |
# File 'app/components/fox_tail/collapsible_trigger_component.rb', line 6 def trigger_type [:trigger_type] ||= :click end |