Skip to main content

add_chrome

Function add_chrome 

Source
pub async fn add_chrome(
    ctx: &mut Context,
    tenant: &Tenant,
    active_tab: &str,
    session_user: Option<&User>,
)
Expand description

Fill a template context with the admin chrome — sidebar, branding, locale, the signed-in user.

Re-exported for host applications implementing admin_page::AdminPageHandler: a custom page that extends rcms_admin/_base.html cannot render without it, and reproducing it by hand means roughly two dozen variables that drift silently on the next release. Add the chrome variables every section template reads from _base.html: which sidebar tab is active, the brand-display name, the current tenant slug, and — when a SessionUser is in scope — the sidebar gating set + per-user timezone.

Pass session_user.as_ref() from the handler signature; pass None for anon flows (login / password-reset). When None, sidebar_gating stays false so every sidebar item renders.

Public so a host application’s AdminPageHandler can render inside the admin chrome. Without it the extension point only works for a page that does NOT extend rcms_admin/_base.html, since that template dereferences roughly two dozen chrome variables — and hand-supplying them in a host app is a copy that drifts silently on every release.