PhoenixLiveCalendar.Views.ResourceView (PhoenixLiveCalendar v0.3.0)

Copy Markdown View Source

Resource columns view — resources displayed as columns in a day/week time grid.

Each resource gets its own column. Used for side-by-side comparison of schedules (e.g., multiple practitioners, rooms, or equipment).

Summary

Functions

Renders a resource-column time grid.

Functions

resource_view(assigns)

Renders a resource-column time grid.

Attributes

  • date — The date to display
  • id — optional per-instance prefix for event DOM ids
  • resources — List of PhoenixLiveCalendar.Resource structs (one column each)
  • events — List of PhoenixLiveCalendar.Event structs (linked via resource_id)
  • min_time — Earliest visible time (default: ~T[00:00:00])
  • max_time — Latest visible time (default: ~T[23:59:59])
  • slot_duration — Slot duration in minutes (default: 30)
  • slot_height — CSS height per slot (default: "3rem")
  • show_now_indicator — Show current time line (default: true; hidden when now falls outside the visible window)
  • today — Today's date for the now indicator (default: Date.utc_today())
  • now — Current wall-clock time (default: Time.utc_now())
  • event_content:auto (default) tiers each block's content by its estimated height, like the week grid; pass a tier to force it
  • min_event_height — CSS floor for a block's height (default "1.25rem"; "0" disables)
  • on_time_click — Handler for time slot clicks
  • on_event_click — Handler for event clicks
  • translations — Translation overrides
  • time_format:h24 or :h12 (default: :h24)
  • class — Additional CSS classes
  • dir — Text direction (default: :ltr)

Events are filtered to those occupying date (an event may target a column via resource_id or the plural resource_ids); midnight-crossing events clamp to the date like the week grid and timeline.

Slots

  • event — Custom event rendering
  • resource_header — Custom resource column header. Receives the resource.

Attributes

  • date (Date) (required)
  • id (:string) - Optional prefix for generated event DOM ids. Set it when two views on one page can render the SAME events — without it their per-event ids collide. Defaults to nil.
  • resources (:list) (required)
  • events (:list) - Defaults to [].
  • min_time (Time) - Defaults to ~T[00:00:00].
  • max_time (Time) - Defaults to ~T[23:59:59].
  • slot_duration (:integer) - Defaults to 30.
  • slot_height (:string) - Defaults to "3rem".
  • show_now_indicator (:boolean) - Defaults to true.
  • today (:any) - Date | nil (server today) | :none (no today highlight). Defaults to nil.

  • now (Time) - Defaults to nil.
  • event_content (:atom) - Defaults to :auto. Must be one of :auto, :detail, :inline, :title, or :none.
  • min_event_height (:string) - Defaults to "1.25rem".
  • on_time_click (:any) - Defaults to nil.
  • on_event_click (:any) - Defaults to nil.
  • translations (:map) - Defaults to %{}.
  • time_format (:atom) - Defaults to :h24.
  • class (:string) - Defaults to "".
  • dir (:atom) - Defaults to :ltr.

Slots

  • event
  • resource_header