Class: SdrViewComponents::Forms::ToggleComponent
- Inherits:
-
FieldComponent
- Object
- ViewComponent::Base
- BaseComponent
- FieldComponent
- SdrViewComponents::Forms::ToggleComponent
- Defined in:
- app/components/sdr_view_components/forms/toggle_component.rb
Overview
Component for a toggle-like radio button group field
Instance Attribute Summary collapse
-
#field_name ⇒ Object
readonly
Returns the value of attribute field_name.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
Attributes inherited from FieldComponent
Instance Method Summary collapse
-
#initialize(form:, field_name:, **args) ⇒ ToggleComponent
constructor
A new instance of ToggleComponent.
Methods inherited from FieldComponent
#container_args, #container_classes, #error_args, #help_text_args, #help_text_below?, #input_args, #input_component, #label_args, #label_field_name
Methods inherited from BaseComponent
#args_for, #merge_actions, #merge_classes
Constructor Details
#initialize(form:, field_name:, **args) ⇒ ToggleComponent
Returns a new instance of ToggleComponent.
14 15 16 17 18 19 |
# File 'app/components/sdr_view_components/forms/toggle_component.rb', line 14 def initialize(form:, field_name:, **args) @form = form @field_name = field_name args[:label_classes] = merge_classes('d-block', args[:label_classes]) super end |
Instance Attribute Details
#field_name ⇒ Object (readonly)
Returns the value of attribute field_name.
21 22 23 |
# File 'app/components/sdr_view_components/forms/toggle_component.rb', line 21 def field_name @field_name end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
21 22 23 |
# File 'app/components/sdr_view_components/forms/toggle_component.rb', line 21 def form @form end |