Show settings cog on root header for admin users

Pass settings_url and is_admin to header-row component so the blog
settings cog appears on the root header row for admin users across
all services. Links to blog /admin/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 22:47:32 +00:00
parent 75cb5d43b9
commit b6119b7f04

View File

@@ -33,6 +33,9 @@ def get_asset_url(ctx: dict) -> str:
def root_header_html(ctx: dict, *, oob: bool = False) -> str:
"""Build the root header row HTML."""
rights = ctx.get("rights") or {}
is_admin = rights.get("admin") if isinstance(rights, dict) else getattr(rights, "admin", False)
settings_url = call_url(ctx, "blog_url", "/admin/") if is_admin else ""
return render(
"header-row",
cart_mini_html=ctx.get("cart_mini_html", ""),
@@ -42,6 +45,8 @@ def root_header_html(ctx: dict, *, oob: bool = False) -> str:
nav_tree_html=ctx.get("nav_tree_html", ""),
auth_menu_html=ctx.get("auth_menu_html", ""),
nav_panel_html=ctx.get("nav_panel_html", ""),
settings_url=settings_url,
is_admin=is_admin,
oob=oob,
)