Eliminate payments sub-admin row in cart, show selection on admin label
Same pattern as blog: remove the level-3 payments header row, instead show "payments" in white text next to "admin" on the admin row. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any
|
||||
from markupsafe import escape
|
||||
|
||||
from shared.sexp.jinja_bridge import render, load_service_components
|
||||
from shared.sexp.helpers import (
|
||||
@@ -722,25 +723,19 @@ async def render_checkout_error_page(ctx: dict, error: str | None = None, order:
|
||||
# Page admin (/<page_slug>/admin/)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def _cart_page_admin_header_html(ctx: dict, page_post: Any, *, oob: bool = False) -> str:
|
||||
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="admin", icon="fa fa-cog",
|
||||
link_href=link_href, link_label_html=label_html,
|
||||
child_id="page-admin-header-child", oob=oob)
|
||||
|
||||
|
||||
def _cart_payments_header_html(ctx: dict, *, oob: bool = False) -> str:
|
||||
"""Build the payments section header row."""
|
||||
from quart import url_for
|
||||
link_href = url_for("page_admin.payments")
|
||||
return render("menu-row", id="payments-row", level=3, colour="sky",
|
||||
link_href=link_href, link_label="Payments",
|
||||
icon="fa fa-credit-card",
|
||||
child_id="payments-header-child", oob=oob)
|
||||
|
||||
|
||||
def _cart_admin_main_panel_html(ctx: dict) -> str:
|
||||
"""Admin overview panel — links to sub-admin pages."""
|
||||
from quart import url_for
|
||||
@@ -812,9 +807,8 @@ async def render_cart_payments_page(ctx: dict, page_post: Any) -> str:
|
||||
"""Full page: payments config."""
|
||||
content = _cart_payments_main_panel_html(ctx)
|
||||
hdr = root_header_html(ctx)
|
||||
admin_hdr = _cart_page_admin_header_html(ctx, page_post)
|
||||
payments_hdr = _cart_payments_header_html(ctx)
|
||||
child = _page_cart_header_html(ctx, page_post) + admin_hdr + payments_hdr
|
||||
admin_hdr = _cart_page_admin_header_html(ctx, page_post, selected="payments")
|
||||
child = _page_cart_header_html(ctx, page_post) + admin_hdr
|
||||
hdr += render("cart-header-child-nested",
|
||||
outer_html=_cart_header_html(ctx), inner_html=child)
|
||||
return full_page(ctx, header_rows_html=hdr, content_html=content)
|
||||
@@ -823,13 +817,12 @@ async def render_cart_payments_page(ctx: dict, page_post: Any) -> str:
|
||||
async def render_cart_payments_oob(ctx: dict, page_post: Any) -> str:
|
||||
"""OOB response: payments config."""
|
||||
content = _cart_payments_main_panel_html(ctx)
|
||||
admin_hdr = _cart_page_admin_header_html(ctx, page_post)
|
||||
payments_hdr = _cart_payments_header_html(ctx)
|
||||
admin_hdr = _cart_page_admin_header_html(ctx, page_post, selected="payments")
|
||||
oobs = (
|
||||
_cart_payments_header_html(ctx, oob=True)
|
||||
_cart_page_admin_header_html(ctx, page_post, oob=True, selected="payments")
|
||||
+ render("cart-header-child-oob",
|
||||
inner_html=_page_cart_header_html(ctx, page_post)
|
||||
+ admin_hdr + payments_hdr)
|
||||
+ admin_hdr)
|
||||
+ _cart_header_html(ctx, oob=True)
|
||||
+ root_header_html(ctx, oob=True)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user