Class: StimulusPlumbers::Components::Timeline
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::Timeline
- Defined in:
- lib/stimulus_plumbers/components/timeline.rb,
lib/stimulus_plumbers/components/timeline/event.rb,
lib/stimulus_plumbers/components/timeline/group.rb,
lib/stimulus_plumbers/components/timeline/event/slots.rb
Defined Under Namespace
Instance Attribute Summary
Attributes inherited from Plumber::Base
Instance Method Summary collapse
- #event(datetime: nil, **kwargs, &block) ⇒ Object
- #render(orientation: :vertical, interactive: false, **kwargs, &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
#event(datetime: nil, **kwargs, &block) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/stimulus_plumbers/components/timeline.rb', line 17 def event(datetime: nil, **kwargs, &block) ev = Timeline::Event.new(template) html = ev.render( datetime: datetime, interactive: @interactive, orientation: @orientation, **kwargs, &block ) @interactive ||= ev.interactive template.concat(html) end |
#render(orientation: :vertical, interactive: false, **kwargs, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/stimulus_plumbers/components/timeline.rb', line 6 def render(orientation: :vertical, interactive: false, **kwargs, &block) @interactive = interactive @orientation = orientation content = template.capture(self, &block) stimulus = @interactive ? { data: { controller: "timeline" } } : {} = (theme.resolve(:timeline, orientation: orientation), kwargs, stimulus) list = template.content_tag(:ol, content, **) orientation.to_sym == :vertical ? render_vertical_wrapper(list) : list end |