Class: PhlexKit::CalendarPrev
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::CalendarPrev
- Defined in:
- app/components/phlex_kit/calendar/calendar_prev.rb
Overview
Previous-month button, pinned to the header's left edge. See calendar.rb.
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ CalendarPrev
constructor
A new instance of CalendarPrev.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(**attrs) ⇒ CalendarPrev
Returns a new instance of CalendarPrev.
4 5 6 |
# File 'app/components/phlex_kit/calendar/calendar_prev.rb', line 4 def initialize(**attrs) @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/components/phlex_kit/calendar/calendar_prev.rb', line 8 def view_template base = { type: :button, name: "previous-month", class: "pk-calendar-prev", data: { action: "click->phlex-kit--calendar#prevMonth", # target so the controller can disable it at the min-date/from-year bound phlex_kit__calendar_target: "prevButton" } } # Default only when the caller didn't supply their own — `mix` fuses. base[:aria] = { label: "Go to previous month" } unless aria_labelled? (**mix(base, @attrs)) do icon end end |