AttachedDashboard.Web.PageMeta behaviour (AttachedDashboard v0.1.0)

Copy Markdown View Source

Page metadata struct for the dashboard.

Centralises page title, navigation path, and breadcrumb context into a single struct. Each LiveView implements page_meta/2 (one clause per live_action) and calls assign_page_meta/1 after all referenced assigns are set.

Breadcrumbs are built by walking the :parent chain — no separate config needed.

Summary

Callbacks

Returns the page metadata for a given live action.

Functions

Assigns :page_meta and :page_title to the socket by calling page_meta/2 on the view module.

Builds a breadcrumb trail from a PageMeta struct.

Callbacks

page_meta(socket, action)

@callback page_meta(socket :: Phoenix.LiveView.Socket.t(), action :: atom()) ::
  %AttachedDashboard.Web.PageMeta{
    breadcrumb_title: term(),
    parent: term(),
    path: term(),
    title: term()
  }

Returns the page metadata for a given live action.

Functions

assign_page_meta(socket)

Assigns :page_meta and :page_title to the socket by calling page_meta/2 on the view module.

All assigns referenced in page_meta/2 must be set before calling this.