Class: Primer::Forms::SubmitButton
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Primer::Forms::SubmitButton
- Defined in:
- lib/primer/forms/submit_button.rb
Overview
:nodoc:
Defined Under Namespace
Modules: SubmitAttributeGenerator
Instance Attribute Summary
Attributes included from ActsAsComponent
Instance Method Summary collapse
-
#initialize(input:) ⇒ SubmitButton
constructor
A new instance of SubmitButton.
- #input_arguments ⇒ Object
Methods inherited from BaseComponent
#content, inherited, #input?, #perform_render, #to_component, #type
Methods included from ActsAsComponent
#compile!, extended, #renders_templates
Methods included from ClassNameHelper
Constructor Details
#initialize(input:) ⇒ SubmitButton
Returns a new instance of SubmitButton.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/primer/forms/submit_button.rb', line 26 def initialize(input:) @input = input @input.add_input_classes("FormField-input flex-self-start") @input.merge_input_arguments!( SubmitAttributeGenerator.submit_tag_attributes(input.label, name: input.name).deep_symbolize_keys ) # rails uses a string for this, but PVC wants a symbol @input.merge_input_arguments!(type: :submit) # Never disable submit buttons. This overrides the global # ActionView::Base.automatically_disable_submit_tag setting. # Disabling the submit button is not accessible. @input.remove_input_data(:disable_with) end |
Instance Method Details
#input_arguments ⇒ Object
42 43 44 45 46 47 |
# File 'lib/primer/forms/submit_button.rb', line 42 def input_arguments @input_arguments ||= @input.input_arguments.deep_dup.tap do |args| # rails uses :class but PVC wants :classes args[:classes] = args.delete(:class) end end |