Class: SdrViewComponents::Forms::SelectFieldComponent
- Inherits:
-
FieldComponent
- Object
- ViewComponent::Base
- BaseComponent
- FieldComponent
- SdrViewComponents::Forms::SelectFieldComponent
- Defined in:
- app/components/sdr_view_components/forms/select_field_component.rb
Overview
Component for form select fields
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
Attributes inherited from FieldComponent
#args, #field_name, #form, #variant
Instance Method Summary collapse
-
#initialize(options:, prompt: false) ⇒ SelectFieldComponent
constructor
A new instance of SelectFieldComponent.
- #input_component ⇒ Object
Methods inherited from FieldComponent
#container_args, #container_classes, #error_args, #help_text_args, #help_text_below?, #input_args, #label_args, #label_field_name
Methods inherited from BaseComponent
#args_for, #merge_actions, #merge_classes
Constructor Details
#initialize(options:, prompt: false) ⇒ SelectFieldComponent
Returns a new instance of SelectFieldComponent.
7 8 9 10 11 |
# File 'app/components/sdr_view_components/forms/select_field_component.rb', line 7 def initialize(options:, prompt: false, **) @options = @prompt = prompt super(**) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'app/components/sdr_view_components/forms/select_field_component.rb', line 13 def @options end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
13 14 15 |
# File 'app/components/sdr_view_components/forms/select_field_component.rb', line 13 def prompt @prompt end |
Instance Method Details
#input_component ⇒ Object
15 16 17 |
# File 'app/components/sdr_view_components/forms/select_field_component.rb', line 15 def input_component SdrViewComponents::Forms::BasicSelectFieldComponent.new(form:, field_name:, options:, prompt:, **input_args) end |