Class: Polaris::OptionListComponent
- Defined in:
- app/components/polaris/option_list_component.rb
Constant Summary
Constants included from ViewHelper
ViewHelper::POLARIS_HELPERS, ViewHelper::POLARIS_TEXT_STYLES
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
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
Methods included from ViewHelper
#polaris_body_styles, #polaris_html_classes, #polaris_html_styles, #polaris_icon_source
Methods included from StylesListHelper
Methods included from OptionHelper
#append_option, #prepend_option
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #fetch_or_fallback_nested
Methods included from ClassNameHelper
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 |