Class: ViewComponent::Form::GroupedCollectionSelectComponent
- Inherits:
-
FieldComponent
- Object
- BaseComponent
- FieldComponent
- ViewComponent::Form::GroupedCollectionSelectComponent
- Defined in:
- app/components/view_component/form/grouped_collection_select_component.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#group_label_method ⇒ Object
readonly
Returns the value of attribute group_label_method.
-
#group_method ⇒ Object
readonly
Returns the value of attribute group_method.
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#option_key_method ⇒ Object
readonly
Returns the value of attribute option_key_method.
-
#option_value_method ⇒ Object
readonly
Returns the value of attribute option_value_method.
Attributes inherited from FieldComponent
Attributes inherited from BaseComponent
Instance Method Summary collapse
-
#call ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#initialize(form, object_name, method_name, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {}) ⇒ GroupedCollectionSelectComponent
constructor
rubocop:disable Metrics/ParameterLists.
Methods inherited from FieldComponent
#label_text, #method_errors, #method_errors?, #object_method_names, #optional?, #required?, #validators, #value
Methods inherited from BaseComponent
#html_class, #object_errors, #object_errors?
Methods included from ClassNamesHelper
#build_tag_values, #class_names
Constructor Details
#initialize(form, object_name, method_name, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {}) ⇒ GroupedCollectionSelectComponent
rubocop:disable Metrics/ParameterLists
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/components/view_component/form/grouped_collection_select_component.rb', line 10 def initialize( # rubocop:disable Metrics/ParameterLists form, object_name, method_name, collection, group_method, group_label_method, option_key_method, option_value_method, = {}, = {} ) @collection = collection @group_method = group_method @group_label_method = group_label_method @option_key_method = option_key_method @option_value_method = option_value_method @html_options = super(form, object_name, method_name, ) end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
6 7 8 |
# File 'app/components/view_component/form/grouped_collection_select_component.rb', line 6 def collection @collection end |
#group_label_method ⇒ Object (readonly)
Returns the value of attribute group_label_method.
6 7 8 |
# File 'app/components/view_component/form/grouped_collection_select_component.rb', line 6 def group_label_method @group_label_method end |
#group_method ⇒ Object (readonly)
Returns the value of attribute group_method.
6 7 8 |
# File 'app/components/view_component/form/grouped_collection_select_component.rb', line 6 def group_method @group_method end |
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
6 7 8 |
# File 'app/components/view_component/form/grouped_collection_select_component.rb', line 6 def @html_options end |
#option_key_method ⇒ Object (readonly)
Returns the value of attribute option_key_method.
6 7 8 |
# File 'app/components/view_component/form/grouped_collection_select_component.rb', line 6 def option_key_method @option_key_method end |
#option_value_method ⇒ Object (readonly)
Returns the value of attribute option_value_method.
6 7 8 |
# File 'app/components/view_component/form/grouped_collection_select_component.rb', line 6 def option_value_method @option_value_method end |
Instance Method Details
#call ⇒ Object
rubocop:disable Metrics/MethodLength
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/components/view_component/form/grouped_collection_select_component.rb', line 34 def call # rubocop:disable Metrics/MethodLength ActionView::Helpers::Tags::GroupedCollectionSelect.new( object_name, method_name, @view_context, collection, group_method, group_label_method, option_key_method, option_value_method, , ).render end |