Module: StimulusRailsHelpers::RailsHelpers
- Defined in:
- lib/stimulus_rails_helpers/rails_helpers.rb
Instance Method Summary collapse
- #stimulus_data(namespace: nil, controllers: [], values: {}, outlets: {}, actions: {}, targets: {}, **other_data_attributes) ⇒ Object (also: #stim_data)
- #stimulus_element(element = :div, namespace: nil, controllers: [], values: {}, outlets: {}, actions: {}, targets: {}, **other_attributes, &block) ⇒ Object (also: #stim_el)
- #stimulus_namespace(*namespaces) {|namespaces.map { |ns| StimulusRenderer.new(namespace: ns, view_context: self) }| ... } ⇒ Object (also: #stim_ns)
Instance Method Details
#stimulus_data(namespace: nil, controllers: [], values: {}, outlets: {}, actions: {}, targets: {}, **other_data_attributes) ⇒ Object Also known as: stim_data
13 14 15 |
# File 'lib/stimulus_rails_helpers/rails_helpers.rb', line 13 def stimulus_data(namespace: nil, controllers: [], values: {}, outlets: {}, actions: {}, targets: {}, **other_data_attributes) StimulusRenderer.new(namespace:, view_context: self).data(controllers:, values:, outlets:, actions:, targets:, **other_data_attributes) end |
#stimulus_element(element = :div, namespace: nil, controllers: [], values: {}, outlets: {}, actions: {}, targets: {}, **other_attributes, &block) ⇒ Object Also known as: stim_el
8 9 10 |
# File 'lib/stimulus_rails_helpers/rails_helpers.rb', line 8 def stimulus_element(element = :div, namespace: nil, controllers: [], values: {}, outlets: {}, actions: {}, targets: {}, **other_attributes, &block) StimulusRenderer.new(namespace:, view_context: self).element(element, controllers:, values:, outlets:, actions:, targets:, **other_attributes, &block) end |
#stimulus_namespace(*namespaces) {|namespaces.map { |ns| StimulusRenderer.new(namespace: ns, view_context: self) }| ... } ⇒ Object Also known as: stim_ns
3 4 5 |
# File 'lib/stimulus_rails_helpers/rails_helpers.rb', line 3 def stimulus_namespace(*namespaces) yield(*namespaces.map { |ns| StimulusRenderer.new(namespace: ns, view_context: self) }) end |