PhoenixKitDocumentCreator.Web.Helpers (PhoenixKitDocumentCreator v0.9.13)

Copy Markdown View Source

Cross-LiveView helpers for the Document Creator admin pages.

Summary

Functions

The actor opts list to thread into context-fn calls: [actor_uuid: uuid] for a signed-in user, otherwise [] — see PhoenixKitWeb.Actor.opts/1. Pass-through into mutating Documents.* functions for activity-log attribution.

The acting user's uuid, or nil — see PhoenixKitWeb.Actor.uuid/1.

Sets the admin header's trail for a page under the module: the section is Document Creator linking to the landing page, crumbs are every level between it and this page (top down), and title names this page only — the bar draws the separators. The landing page itself sets page_title alone, with no section.

The crumb for the Categories list page.

A text crumb for a category or type, named in locale the way the list page names it. Text, not a link: the Categories list is the only page either record has.

Functions

actor_opts(socket)

@spec actor_opts(Phoenix.LiveView.Socket.t()) :: keyword()

The actor opts list to thread into context-fn calls: [actor_uuid: uuid] for a signed-in user, otherwise [] — see PhoenixKitWeb.Actor.opts/1. Pass-through into mutating Documents.* functions for activity-log attribution.

actor_uuid(socket)

@spec actor_uuid(Phoenix.LiveView.Socket.t()) :: String.t() | nil

The acting user's uuid, or nil — see PhoenixKitWeb.Actor.uuid/1.

assign_trail(socket, title, crumbs \\ [])

Sets the admin header's trail for a page under the module: the section is Document Creator linking to the landing page, crumbs are every level between it and this page (top down), and title names this page only — the bar draws the separators. The landing page itself sets page_title alone, with no section.

categories_crumb()

@spec categories_crumb() :: map()

The crumb for the Categories list page.

record_crumb(record, locale)

@spec record_crumb(struct(), String.t() | nil) :: map()

A text crumb for a category or type, named in locale the way the list page names it. Text, not a link: the Categories list is the only page either record has.