Class: Polaris::OptionList::SectionComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/polaris/option_list/section_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(position: 0, title: nil, form: nil, attribute: nil, name: nil, selected: [], **system_arguments) ⇒ SectionComponent

Returns a new instance of SectionComponent.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/components/polaris/option_list/section_component.rb', line 24

def initialize(
  position: 0,
  title: nil,
  form: nil,
  attribute: nil,
  name: nil,
  selected: [],
  **system_arguments
)
  @position = position
  @title = title
  @form = form
  @attribute = attribute
  @name = name
  @selected = selected
  @system_arguments = system_arguments
end

Instance Method Details

#itemsObject



48
49
50
# File 'app/components/polaris/option_list/section_component.rb', line 48

def items
  radio_buttons.presence || checkboxes.presence || options
end

#system_argumentsObject



42
43
44
45
46
# File 'app/components/polaris/option_list/section_component.rb', line 42

def system_arguments
  @system_arguments.tap do |opts|
    opts[:tag] = "ul"
  end
end