Class: Ariadne::Form::Toggle::Component
- Inherits:
-
BaseComponent
- Object
- ViewComponentContrib::Base
- BaseComponent
- BaseComponent
- Ariadne::Form::Toggle::Component
- Includes:
- Behaviors::Tooltipable
- Defined in:
- app/components/ariadne/form/toggle/component.rb
Constant Summary
Constants inherited from BaseComponent
BaseComponent::ACCEPT_ANYTHING
Constants included from ViewHelper
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Attribute Summary
Attributes included from Ariadne::Forms::ActsAsComponent
Instance Method Summary collapse
Methods included from Behaviors::Tooltipable
Methods inherited from BaseComponent
#content, inherited, #input?, #perform_render, #render?, #to_component, #type
Methods included from Ariadne::Forms::ActsAsComponent
#compile!, extended, #renders_templates
Methods included from ClassNameHelper
Methods inherited from BaseComponent
#class_for, #component, component_id, #component_id, component_name, #html_attributes, i18n_scope, #in_turbo_frame, #in_turbo_stream, #options, stimulus_name, #styles, translate, #validate_aria_label!
Methods included from ViewHelper
Methods included from AttributesHelper
#aria, #data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes, #prepend_action, #prepend_controller, #prepend_data_attribute
Methods included from ViewComponent::StyleVariants
Instance Method Details
#before_render ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/components/ariadne/form/toggle/component.rb', line 42 def before_render @label_id = ::Ariadne::ViewHelper.generate_id if @form_url.present? csrf_token = view_context.form_authenticity_token( form_options: { method: @form_method, action: @form_url, }, ) form_values = { "#{stimulus_name}-csrf-token-value": csrf_token, "#{stimulus_name}-form-method-value": @form_method, "#{stimulus_name}-form-url-value": @form_url, "#{stimulus_name}-turbo-value": @turbo, } html_attrs[:data] = html_attrs[:data].merge(form_values) end end |