Unify post admin nav across all services

Move post admin header into shared/sexp/helpers.py so blog, cart,
events, and market all render the same admin row with identical nav:
calendars | markets | payments | entries | data | edit | settings.

All links are external (cross-service). The selected item shows
highlighted on the right and as white text next to "admin" on the left.

- blog: delegates to shared helper, removes blog-specific nav builder
- cart: delegates to shared helper for payments admin
- events: adds shared admin row (selected=calendars) to calendar admin
- market: adds /<slug>/admin/ route + page_admin blueprint, delegates
  to shared helper (selected=markets). Fixes 404 on page-level admin.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 22:01:56 +00:00
parent 2d08d6f787
commit b47ad6224b
9 changed files with 143 additions and 101 deletions

View File

@@ -12,8 +12,8 @@ from markupsafe import escape
from shared.sexp.jinja_bridge import render, load_service_components
from shared.sexp.helpers import (
call_url, root_header_html, search_desktop_html,
search_mobile_html, full_page, oob_page,
call_url, root_header_html, post_admin_header_html,
search_desktop_html, search_mobile_html, full_page, oob_page,
)
from shared.infrastructure.urls import market_product_url, cart_url
@@ -725,15 +725,9 @@ async def render_checkout_error_page(ctx: dict, error: str | None = None, order:
def _cart_page_admin_header_html(ctx: dict, page_post: Any, *, oob: bool = False,
selected: str = "") -> str:
"""Build the page-level admin header row."""
from quart import url_for
link_href = url_for("page_admin.admin")
label_html = '<i class="fa fa-cog" aria-hidden="true"></i> admin'
if selected:
label_html += f' <span class="text-white">{escape(selected)}</span>'
return render("menu-row", id="page-admin-row", level=2, colour="sky",
link_href=link_href, link_label_html=label_html,
child_id="page-admin-header-child", oob=oob)
"""Build the page-level admin header row — delegates to shared helper."""
slug = page_post.slug if page_post else ""
return post_admin_header_html(ctx, slug, oob=oob, selected=selected)
def _cart_admin_main_panel_html(ctx: dict) -> str: