Class: FoxTail::TriggerBaseComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- Base
- BaseComponent
- FoxTail::TriggerBaseComponent
- Includes:
- Concerns::HasStimulusController
- Defined in:
- app/components/fox_tail/trigger_base_component.rb
Direct Known Subclasses
CollapsibleTriggerComponent, ColorThemeTriggerComponent, DismissibleTriggerComponent, DrawerTriggerComponent, DropdownTriggerComponent, ModalTriggerComponent, PopoverTriggerComponent, TooltipTriggerComponent
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#selector ⇒ Object
readonly
Returns the value of attribute selector.
Attributes inherited from BaseComponent
Instance Method Summary collapse
- #before_render ⇒ Object
- #block? ⇒ Boolean
- #call ⇒ Object
-
#initialize(id, selector, html_attributes = {}, &block) ⇒ TriggerBaseComponent
constructor
A new instance of TriggerBaseComponent.
- #render? ⇒ Boolean
- #stimulus_controller_options ⇒ Object
Methods inherited from BaseComponent
classname_merger, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class
Methods inherited from Base
Constructor Details
#initialize(id, selector, html_attributes = {}, &block) ⇒ TriggerBaseComponent
Returns a new instance of TriggerBaseComponent.
10 11 12 13 14 15 |
# File 'app/components/fox_tail/trigger_base_component.rb', line 10 def initialize(id, selector, html_attributes = {}, &block) super(html_attributes) @id = id @selector = selector @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'app/components/fox_tail/trigger_base_component.rb', line 6 def block @block end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'app/components/fox_tail/trigger_base_component.rb', line 6 def id @id end |
#selector ⇒ Object (readonly)
Returns the value of attribute selector.
6 7 8 |
# File 'app/components/fox_tail/trigger_base_component.rb', line 6 def selector @selector end |
Instance Method Details
#before_render ⇒ Object
21 22 23 24 25 26 |
# File 'app/components/fox_tail/trigger_base_component.rb', line 21 def before_render super html_attributes[:id] = id html_attributes[:class] = html_class end |
#block? ⇒ Boolean
17 18 19 |
# File 'app/components/fox_tail/trigger_base_component.rb', line 17 def block? !!block end |
#call ⇒ Object
32 33 34 |
# File 'app/components/fox_tail/trigger_base_component.rb', line 32 def call block? ? view_context.capture(self, &block) : content end |
#render? ⇒ Boolean
28 29 30 |
# File 'app/components/fox_tail/trigger_base_component.rb', line 28 def render? content? || block? end |
#stimulus_controller_options ⇒ Object
36 37 38 39 40 41 |
# File 'app/components/fox_tail/trigger_base_component.rb', line 36 def { selector: selector, trigger_type: trigger_type } end |