Class: StimulusPlumbers::Components::OrderedList

Inherits:
Plumber::Base show all
Defined in:
lib/stimulus_plumbers/components/ordered_list.rb,
lib/stimulus_plumbers/components/ordered_list/item.rb,
lib/stimulus_plumbers/components/ordered_list/item/slots.rb

Defined Under Namespace

Classes: Item

Instance Attribute Summary

Attributes inherited from Plumber::Base

#template

Instance Method Summary collapse

Methods inherited from Plumber::Base

#initialize, #theme

Methods included from Plumber::Renderer

#set_slots, #slot_block_for, #slot_kwargs_for, #slot_renderable?

Methods included from Plumber::Options::Aria

#labelled_aria

Methods included from Plumber::Options::Html

#merge_html_options

Constructor Details

This class inherits a constructor from StimulusPlumbers::Plumber::Base

Instance Method Details

#item(content = nil, **kwargs, &block) ⇒ Object



19
20
21
# File 'lib/stimulus_plumbers/components/ordered_list.rb', line 19

def item(content = nil, **kwargs, &block)
  OrderedList::Item.new(template).render(content, **kwargs, &block)
end

#render(move_key: "Alt", editing: false, orientation: nil, role: "list", **kwargs, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/stimulus_plumbers/components/ordered_list.rb', line 6

def render(move_key: "Alt", editing: false, orientation: nil, role: "list", **kwargs, &block)
  stimulus = {
    data: {
      controller:                      "reorderable",
      "reorderable-move-key-value":    move_key,
      "reorderable-editing-value":     editing,
      "reorderable-orientation-value": orientation
    }.compact
  }
  html_options = merge_html_options(theme.resolve(:ordered_list), kwargs, stimulus)
  template.(:ol, template.capture(self, &block), **html_options, role: role)
end