Unify post admin nav across all services
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m56s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m56s
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:
@@ -15,6 +15,7 @@ from shared.sexp.jinja_bridge import render, load_service_components
|
||||
from shared.sexp.helpers import (
|
||||
call_url, get_asset_url, root_header_html,
|
||||
post_header_html as _shared_post_header_html,
|
||||
post_admin_header_html,
|
||||
oob_header_html,
|
||||
search_mobile_html, search_desktop_html,
|
||||
full_page, oob_page,
|
||||
@@ -1352,11 +1353,19 @@ async def render_day_admin_oob(ctx: dict) -> str:
|
||||
# Calendar admin
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def _events_post_admin_header_html(ctx: dict, *, oob: bool = False,
|
||||
selected: str = "") -> str:
|
||||
"""Post-level admin row for events — delegates to shared helper."""
|
||||
slug = (ctx.get("post") or {}).get("slug", "")
|
||||
return post_admin_header_html(ctx, slug, oob=oob, selected=selected)
|
||||
|
||||
|
||||
async def render_calendar_admin_page(ctx: dict) -> str:
|
||||
"""Full page: calendar admin."""
|
||||
content = _calendar_admin_main_panel_html(ctx)
|
||||
hdr = root_header_html(ctx)
|
||||
child = (_post_header_html(ctx)
|
||||
+ _events_post_admin_header_html(ctx, selected="calendars")
|
||||
+ _calendar_header_html(ctx) + _calendar_admin_header_html(ctx))
|
||||
hdr += render("header-child", inner_html=child)
|
||||
return full_page(ctx, header_rows_html=hdr, content_html=content)
|
||||
@@ -1365,7 +1374,8 @@ async def render_calendar_admin_page(ctx: dict) -> str:
|
||||
async def render_calendar_admin_oob(ctx: dict) -> str:
|
||||
"""OOB response: calendar admin."""
|
||||
content = _calendar_admin_main_panel_html(ctx)
|
||||
oobs = _calendar_header_html(ctx, oob=True)
|
||||
oobs = (_events_post_admin_header_html(ctx, oob=True, selected="calendars")
|
||||
+ _calendar_header_html(ctx, oob=True))
|
||||
oobs += _oob_header_html("calendar-header-child", "calendar-admin-header-child",
|
||||
_calendar_admin_header_html(ctx))
|
||||
return oob_page(ctx, oobs_html=oobs, content_html=content)
|
||||
@@ -1383,6 +1393,7 @@ async def render_slots_page(ctx: dict) -> str:
|
||||
content = render_slots_table(slots, calendar)
|
||||
hdr = root_header_html(ctx)
|
||||
child = (_post_header_html(ctx)
|
||||
+ _events_post_admin_header_html(ctx, selected="calendars")
|
||||
+ _calendar_header_html(ctx) + _calendar_admin_header_html(ctx))
|
||||
hdr += render("header-child", inner_html=child)
|
||||
return full_page(ctx, header_rows_html=hdr, content_html=content)
|
||||
@@ -1393,7 +1404,8 @@ async def render_slots_oob(ctx: dict) -> str:
|
||||
slots = ctx.get("slots") or []
|
||||
calendar = ctx.get("calendar")
|
||||
content = render_slots_table(slots, calendar)
|
||||
oobs = _calendar_admin_header_html(ctx, oob=True)
|
||||
oobs = (_events_post_admin_header_html(ctx, oob=True, selected="calendars")
|
||||
+ _calendar_admin_header_html(ctx, oob=True))
|
||||
return oob_page(ctx, oobs_html=oobs, content_html=content)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user