Cross-cutting helpers shared by the Dashboards LiveViews.
actor_opts/1 is the canonical way to thread the acting user's uuid into
context mutations that accept a trailing opts \ [] (for activity logging).
Summary
Functions
Keyword opts threading the acting user's uuid into context mutations.
The current user's uuid from socket assigns, or nil.
Translated label for a breakpoint tier. Literal-call clauses on purpose: the
gettext extractor only sees literal arguments, so rendering
Breakpoints.get(key).label through a variable would never localize.
Counter for daisyUI 5.0.x's modal/drawer-open scrollbar-gutter: stable (the
layered zero-specificity original loses to this unlayered rule). The same
rule ships in core's admin layout now — delete this helper once the core pin
includes it.
All roles (for pickers); [] when the roles API is unavailable.
Translated label for a dashboard scope enum value.
Dynamic translation for catalog DATA (widget names, descriptions, view names, settings labels — plain strings from the provider contract). Falls back to the input when no translation exists, so provider strings pass through.
The current user's role uuids, mapped from the scope's cached role names — used
by both LiveViews to resolve role-scoped dashboard visibility. Reuses a
@roles assign if present, else queries core once. [] when roles are
unavailable.
Functions
@spec actor_opts(Phoenix.LiveView.Socket.t()) :: keyword()
Keyword opts threading the acting user's uuid into context mutations.
Returns [actor_uuid: uuid], or [] when there is no current user (so the
context call is unaffected).
@spec actor_uuid(Phoenix.LiveView.Socket.t()) :: String.t() | nil
The current user's uuid from socket assigns, or nil.
Translated label for a breakpoint tier. Literal-call clauses on purpose: the
gettext extractor only sees literal arguments, so rendering
Breakpoints.get(key).label through a variable would never localize.
@spec gutter_fix_style() :: Phoenix.HTML.safe()
Counter for daisyUI 5.0.x's modal/drawer-open scrollbar-gutter: stable (the
layered zero-specificity original loses to this unlayered rule). The same
rule ships in core's admin layout now — delete this helper once the core pin
includes it.
@spec list_roles() :: [struct()]
All roles (for pickers); [] when the roles API is unavailable.
Translated label for a dashboard scope enum value.
Dynamic translation for catalog DATA (widget names, descriptions, view names, settings labels — plain strings from the provider contract). Falls back to the input when no translation exists, so provider strings pass through.
@spec user_role_uuids(Phoenix.LiveView.Socket.t()) :: [String.t()]
The current user's role uuids, mapped from the scope's cached role names — used
by both LiveViews to resolve role-scoped dashboard visibility. Reuses a
@roles assign if present, else queries core once. [] when roles are
unavailable.