Class: Polaris::OptionListComponent
- Inherits:
-
Component
- Object
- Component
- Polaris::OptionListComponent
- Defined in:
- app/components/polaris/option_list_component.rb
Instance Method Summary collapse
-
#initialize(title: nil, form: nil, attribute: nil, name: nil, selected: [], **system_arguments) ⇒ OptionListComponent
constructor
A new instance of OptionListComponent.
- #items ⇒ Object
- #system_arguments ⇒ Object
Constructor Details
#initialize(title: nil, form: nil, attribute: nil, name: nil, selected: [], **system_arguments) ⇒ OptionListComponent
Returns a new instance of OptionListComponent.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/components/polaris/option_list_component.rb', line 37 def initialize( title: nil, form: nil, attribute: nil, name: nil, selected: [], **system_arguments ) @sections_count = 0 @title = title @form = form @attribute = attribute @name = name @selected = selected @system_arguments = system_arguments end |
Instance Method Details
#items ⇒ Object
63 64 65 |
# File 'app/components/polaris/option_list_component.rb', line 63 def items .presence || checkboxes.presence || end |
#system_arguments ⇒ Object
55 56 57 58 59 60 61 |
# File 'app/components/polaris/option_list_component.rb', line 55 def system_arguments @system_arguments.tap do |args| args[:data] ||= {} prepend_option(args[:data], :controller, "polaris-option-list") args[:data][:polaris_option_list_selected_class] = "Polaris-OptionList-Option--select" end end |