Class: StimulusPlumbers::Components::Calendar
- Inherits:
-
Plumber::Base
show all
- Defined in:
- lib/stimulus_plumbers/components/calendar.rb,
lib/stimulus_plumbers/components/calendar/turbo.rb,
lib/stimulus_plumbers/components/calendar/turbo/days_of_week.rb,
lib/stimulus_plumbers/components/calendar/turbo/days_of_month.rb,
lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb,
lib/stimulus_plumbers/components/calendar/turbo/years_of_decade.rb
Defined Under Namespace
Classes: Turbo
Constant Summary
collapse
- MONTH_STIMULUS_CONTROLLER =
"calendar-month"
- YEAR_STIMULUS_CONTROLLER =
"calendar-year"
- DECADE_STIMULUS_CONTROLLER =
"calendar-decade"
- OBSERVER_STIMULUS_CONTROLLER =
"calendar-observer"
- STIMULUS_ACTION =
"click->#{OBSERVER_STIMULUS_CONTROLLER}#onSelect".freeze
Instance Attribute Summary
#template
Instance Method Summary
collapse
#initialize, #theme
#set_slots, #slot_block_for, #slot_kwargs_for, #slot_renderable?
#labelled_aria
#merge_html_options
Instance Method Details
#decade ⇒ Object
43
44
45
|
# File 'lib/stimulus_plumbers/components/calendar.rb', line 43
def decade
template.tag.div(**decade_options)
end
|
#month ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/stimulus_plumbers/components/calendar.rb', line 28
def month
template.content_tag(:div, **month_options) do
template.safe_join(
[
template.tag.div(**dow_options),
template.tag.div(**dom_options)
]
)
end
end
|
#render(**kwargs) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/stimulus_plumbers/components/calendar.rb', line 12
def render(**kwargs)
html_options = merge_html_options(
theme.resolve(:calendar),
kwargs,
{
data: {
controller: "#{MONTH_STIMULUS_CONTROLLER} #{OBSERVER_STIMULUS_CONTROLLER}",
action: STIMULUS_ACTION
}
}
)
template.content_tag(:div, **html_options, role: "grid") do
template.safe_join([month, year, decade])
end
end
|
#year ⇒ Object
39
40
41
|
# File 'lib/stimulus_plumbers/components/calendar.rb', line 39
def year
template.tag.div(**year_options)
end
|