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_icon_source, #polaris_inversed_colors
Methods included from OptionHelper
#append_option, #prepend_option
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean
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.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/components/polaris/option_list_component.rb', line 34 def initialize( title: nil, form: nil, attribute: nil, name: nil, selected: [], **system_arguments ) @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
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/components/polaris/option_list_component.rb', line 50 def system_arguments @system_arguments.tap do |opts| opts[:tag] = "ul" opts[:data] ||= {} prepend_option(opts[:data], :controller, "polaris-option-list") opts[:data][:polaris_option_list_selected_class] = "Polaris-OptionList-Option--select" opts[:classes] = class_names( @system_arguments[:classes], "Polaris-OptionList" ) end end |