Class: SdrViewComponents::Forms::SubmitComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- SdrViewComponents::Forms::SubmitComponent
- Defined in:
- app/components/sdr_view_components/forms/submit_component.rb
Overview
Component for a form submit button
Instance Attribute Summary collapse
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#form_id ⇒ Object
readonly
Returns the value of attribute form_id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #classes ⇒ Object
-
#initialize(label: nil, value: nil, form_id: nil, variant: :primary, classes: [], **options) ⇒ SubmitComponent
constructor
rubocop:disable Metrics/ParameterLists.
Methods inherited from BaseComponent
#args_for, #merge_actions, #merge_classes
Constructor Details
#initialize(label: nil, value: nil, form_id: nil, variant: :primary, classes: [], **options) ⇒ SubmitComponent
rubocop:disable Metrics/ParameterLists
7 8 9 10 11 12 13 14 15 16 |
# File 'app/components/sdr_view_components/forms/submit_component.rb', line 7 def initialize(label: nil, value: nil, form_id: nil, variant: :primary, classes: [], **) # rubocop:disable Metrics/ParameterLists # Either provide label OR value and content @form_id = form_id @label = label @variant = variant @options = @classes = classes @value = value || label super() end |
Instance Attribute Details
#form ⇒ Object (readonly)
Returns the value of attribute form.
18 19 20 |
# File 'app/components/sdr_view_components/forms/submit_component.rb', line 18 def form @form end |
#form_id ⇒ Object (readonly)
Returns the value of attribute form_id.
18 19 20 |
# File 'app/components/sdr_view_components/forms/submit_component.rb', line 18 def form_id @form_id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
18 19 20 |
# File 'app/components/sdr_view_components/forms/submit_component.rb', line 18 def label @label end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
18 19 20 |
# File 'app/components/sdr_view_components/forms/submit_component.rb', line 18 def @options end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
18 19 20 |
# File 'app/components/sdr_view_components/forms/submit_component.rb', line 18 def value @value end |
Instance Method Details
#classes ⇒ Object
20 21 22 |
# File 'app/components/sdr_view_components/forms/submit_component.rb', line 20 def classes ComponentSupport::ButtonSupport.classes(variant: @variant, classes: @classes) end |