Class: FoxTail::DrawerTriggerComponent::StimulusController

Inherits:
StimulusController show all
Defined in:
app/components/fox_tail/drawer_trigger_component.rb

Instance Attribute Summary

Attributes inherited from StimulusController

#identifier

Instance Method Summary collapse

Methods inherited from StimulusController

#action, #action_param_key, #build_actions, #classes_key, #config, #event, #initialize, #merge, #merge!, #outlet_key, #target_key, #to_s, #to_sym, #value_key

Constructor Details

This class inherits a constructor from FoxTail::StimulusController

Instance Method Details

#attributes(options = {}) ⇒ Object



24
25
26
27
28
29
30
31
# File 'app/components/fox_tail/drawer_trigger_component.rb', line 24

def attributes(options = {})
  attributes = super
  attributes[:data][outlet_key(drawer_identifier)] = options[:selector]
  attributes[:data][classes_key(:open)] = options[:open_classes]
  attributes[:data][classes_key(:closed)] = options[:closed_classes]
  attributes[:data][:action] = action options.fetch(:action, :toggle), event: options.fetch(:trigger_type, :click)
  attributes
end

#drawer_identifierObject



20
21
22
# File 'app/components/fox_tail/drawer_trigger_component.rb', line 20

def drawer_identifier
  FoxTail::DrawerComponent.stimulus_controller_identifier
end