Class: StimulusPlumbers::Components::Calendar::Month::Turbo::DaysOfMonth
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::Calendar::Month::Turbo::DaysOfMonth
- Defined in:
- lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb
Constant Summary collapse
- DAYS_IN_WEEK =
7
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#selectable ⇒ Object
readonly
Returns the value of attribute selectable.
-
#selected_date ⇒ Object
readonly
Returns the value of attribute selected_date.
-
#show_other_months ⇒ Object
readonly
Returns the value of attribute show_other_months.
-
#today ⇒ Object
readonly
Returns the value of attribute today.
Attributes inherited from Plumber::Base
Instance Method Summary collapse
-
#initialize(template, date: Date.today, today: Date.today, selectable: false, selected_date: nil, show_other_months: false) ⇒ DaysOfMonth
constructor
A new instance of DaysOfMonth.
- #render(**kwargs) ⇒ Object
Methods inherited from Plumber::Base
Methods included from Plumber::HtmlOptions
#merge_html_options, #merge_string_option, #normalize_part
Constructor Details
#initialize(template, date: Date.today, today: Date.today, selectable: false, selected_date: nil, show_other_months: false) ⇒ DaysOfMonth
Returns a new instance of DaysOfMonth.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb', line 13 def initialize( template, date: Date.today, today: Date.today, selectable: false, selected_date: nil, show_other_months: false ) super(template) @date = date @today = today @selectable = selectable @selected_date = selected_date @show_other_months = show_other_months end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
11 12 13 |
# File 'lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb', line 11 def date @date end |
#selectable ⇒ Object (readonly)
Returns the value of attribute selectable.
11 12 13 |
# File 'lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb', line 11 def selectable @selectable end |
#selected_date ⇒ Object (readonly)
Returns the value of attribute selected_date.
11 12 13 |
# File 'lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb', line 11 def selected_date @selected_date end |
#show_other_months ⇒ Object (readonly)
Returns the value of attribute show_other_months.
11 12 13 |
# File 'lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb', line 11 def show_other_months @show_other_months end |
#today ⇒ Object (readonly)
Returns the value of attribute today.
11 12 13 |
# File 'lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb', line 11 def today @today end |
Instance Method Details
#render(**kwargs) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb', line 29 def render(**kwargs) = ( { classes: theme.resolve(:calendar_days_of_month).fetch(:classes, "") }, kwargs ) template.content_tag(:div, **, role: "rowgroup") do template.safe_join( build_days.each_slice(DAYS_IN_WEEK).map do |week| template.content_tag(:div, role: "row") do days_in_week(week) end end ) end end |