Class: StimulusPlumbers::Components::Calendar::Turbo
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::Calendar::Turbo
- Defined in:
- 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: DaysOfMonth, DaysOfWeek, MonthsOfYear, YearsOfDecade
Constant Summary collapse
- MONTH_SELECTOR_CONTROLLER =
"calendar-month-selector"- YEAR_SELECTOR_CONTROLLER =
"calendar-year-selector"- DECADE_SELECTOR_CONTROLLER =
"calendar-decade-selector"
Instance Attribute Summary
Attributes inherited from Plumber::Base
Instance Method Summary collapse
- #decade(date: Date.today, today: Date.today, selected_date: nil, since: nil, till: nil, disabled_years: [], **kwargs) ⇒ Object
- #month(date: Date.today, today: Date.today, show_other_months: false, weekday_format: :short, selectable: false, selected_date: nil, since: nil, till: nil, **kwargs) ⇒ Object
- #year(date: Date.today, today: Date.today, selected_date: nil, month_format: :short, since: nil, till: nil, disabled_months: [], **kwargs) ⇒ 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
#decade(date: Date.today, today: Date.today, selected_date: nil, since: nil, till: nil, disabled_years: [], **kwargs) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/stimulus_plumbers/components/calendar/turbo.rb', line 79 def decade( date: Date.today, today: Date.today, selected_date: nil, since: nil, till: nil, disabled_years: [], **kwargs ) = ( theme.resolve(:calendar_quarter_grid), kwargs, { role: "grid", aria: { label: I18n.t("stimulus_plumbers.calendar.decade_view") }, data: { controller: DECADE_SELECTOR_CONTROLLER } } ) template.content_tag(:div, **) do Turbo::YearsOfDecade.new( template, date: date, today: today, selected_date: selected_date, since: since, till: till, disabled_years: disabled_years ).render end end |
#month(date: Date.today, today: Date.today, show_other_months: false, weekday_format: :short, selectable: false, selected_date: nil, since: nil, till: nil, **kwargs) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/stimulus_plumbers/components/calendar/turbo.rb', line 11 def month( date: Date.today, today: Date.today, show_other_months: false, weekday_format: :short, selectable: false, selected_date: nil, since: nil, till: nil, **kwargs ) = ( theme.resolve(:calendar), kwargs, { data: { controller: MONTH_SELECTOR_CONTROLLER } } ) template.content_tag(:div, role: "grid", **) do template.safe_join( [ Turbo::DaysOfWeek.new(template, format: weekday_format).render, Turbo::DaysOfMonth.new( template, date: date, today: today, selectable: selectable, selected_date: selected_date, show_other_months: show_other_months, since: since, till: till ).render ] ) end end |
#year(date: Date.today, today: Date.today, selected_date: nil, month_format: :short, since: nil, till: nil, disabled_months: [], **kwargs) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/stimulus_plumbers/components/calendar/turbo.rb', line 46 def year( date: Date.today, today: Date.today, selected_date: nil, month_format: :short, since: nil, till: nil, disabled_months: [], **kwargs ) = ( theme.resolve(:calendar_quarter_grid), kwargs, { role: "grid", aria: { label: I18n.t("stimulus_plumbers.calendar.year_view") }, data: { controller: YEAR_SELECTOR_CONTROLLER } } ) template.content_tag(:div, **) do Turbo::MonthsOfYear.new( template, date: date, today: today, selected_date: selected_date, format: month_format, since: since, till: till, disabled_months: disabled_months ).render end end |