Class: StimulusPlumbers::Components::OrderedList::Item
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::OrderedList::Item
- Defined in:
- lib/stimulus_plumbers/components/ordered_list/item.rb,
lib/stimulus_plumbers/components/ordered_list/item/slots.rb
Defined Under Namespace
Classes: Slots
Constant Summary collapse
- HANDLE_ACTION =
"pointerdown->reorderable#onPointerDown pointermove->reorderable#onPointerMove " \ "pointerup->reorderable#onPointerUp"
Instance Attribute Summary
Attributes inherited from Plumber::Base
Instance Method Summary collapse
- #build(id:, handle: :item, &block) ⇒ Object
- #render(content = nil, id:, handle: :item, url: nil, target: nil, active: false, **html_options, &block) ⇒ Object
Methods inherited from Plumber::Base
Methods included from Plumber::Renderer
#set_slots, #slot_block_for, #slot_kwargs_for, #slot_renderable?
Methods included from Plumber::Options::Aria
Methods included from Plumber::Options::Html
Constructor Details
This class inherits a constructor from StimulusPlumbers::Plumber::Base
Instance Method Details
#build(id:, handle: :item, &block) ⇒ Object
28 29 30 31 32 |
# File 'lib/stimulus_plumbers/components/ordered_list/item.rb', line 28 def build(id:, handle: :item, &block) @handle = handle = (theme.resolve(:ordered_list_item), { id: id }, item_target_attrs) template.capture(, &block) end |
#render(content = nil, id:, handle: :item, url: nil, target: nil, active: false, **html_options, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/stimulus_plumbers/components/ordered_list/item.rb', line 10 def render(content = nil, id:, handle: :item, url: nil, target: nil, active: false, **, &block) (id, url, ) slots = build_slots(content, &block) build(id: id, handle: handle) do |attrs| template.content_tag(:li, **attrs) do template.safe_join( [ render_icon_position(slots, :leading), render_body(slots, url: url, target: target, active: active, **), render_icon_position(slots, :trailing) ] ) end end end |