Class: PhlexKit::CalendarBody

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/calendar/calendar_body.rb

Overview

The

the controller renders the weekday header + day grid into. See calendar.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ CalendarBody

Returns a new instance of CalendarBody.



5
6
7
# File 'app/components/phlex_kit/calendar/calendar_body.rb', line 5

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#view_templateObject



9
10
11
12
13
14
15
16
17
18
19
# File 'app/components/phlex_kit/calendar/calendar_body.rb', line 9

def view_template
  table(**mix({
    class: "pk-calendar-body",
    data: {
      phlex_kit__calendar_target: "calendar",
      # Delegated arrow-key/Home/End navigation for the day grid (the
      # buttons are re-rendered wholesale, so the action lives here).
      action: "keydown->phlex-kit--calendar#onKeydown"
    }
  }, @attrs))
end