Eliminate payments sub-admin row in cart, show selection on admin label
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m25s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m25s
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
|
import os
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
from markupsafe import escape
|
||||||
|
|
||||||
from shared.sexp.jinja_bridge import render, load_service_components
|
from shared.sexp.jinja_bridge import render, load_service_components
|
||||||
from shared.sexp.helpers import (
|
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/)
|
# 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."""
|
"""Build the page-level admin header row."""
|
||||||
from quart import url_for
|
from quart import url_for
|
||||||
link_href = url_for("page_admin.admin")
|
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",
|
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)
|
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:
|
def _cart_admin_main_panel_html(ctx: dict) -> str:
|
||||||
"""Admin overview panel — links to sub-admin pages."""
|
"""Admin overview panel — links to sub-admin pages."""
|
||||||
from quart import url_for
|
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."""
|
"""Full page: payments config."""
|
||||||
content = _cart_payments_main_panel_html(ctx)
|
content = _cart_payments_main_panel_html(ctx)
|
||||||
hdr = root_header_html(ctx)
|
hdr = root_header_html(ctx)
|
||||||
admin_hdr = _cart_page_admin_header_html(ctx, page_post)
|
admin_hdr = _cart_page_admin_header_html(ctx, page_post, selected="payments")
|
||||||
payments_hdr = _cart_payments_header_html(ctx)
|
child = _page_cart_header_html(ctx, page_post) + admin_hdr
|
||||||
child = _page_cart_header_html(ctx, page_post) + admin_hdr + payments_hdr
|
|
||||||
hdr += render("cart-header-child-nested",
|
hdr += render("cart-header-child-nested",
|
||||||
outer_html=_cart_header_html(ctx), inner_html=child)
|
outer_html=_cart_header_html(ctx), inner_html=child)
|
||||||
return full_page(ctx, header_rows_html=hdr, content_html=content)
|
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:
|
async def render_cart_payments_oob(ctx: dict, page_post: Any) -> str:
|
||||||
"""OOB response: payments config."""
|
"""OOB response: payments config."""
|
||||||
content = _cart_payments_main_panel_html(ctx)
|
content = _cart_payments_main_panel_html(ctx)
|
||||||
admin_hdr = _cart_page_admin_header_html(ctx, page_post)
|
admin_hdr = _cart_page_admin_header_html(ctx, page_post, selected="payments")
|
||||||
payments_hdr = _cart_payments_header_html(ctx)
|
|
||||||
oobs = (
|
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",
|
+ render("cart-header-child-oob",
|
||||||
inner_html=_page_cart_header_html(ctx, page_post)
|
inner_html=_page_cart_header_html(ctx, page_post)
|
||||||
+ admin_hdr + payments_hdr)
|
+ admin_hdr)
|
||||||
+ _cart_header_html(ctx, oob=True)
|
+ _cart_header_html(ctx, oob=True)
|
||||||
+ root_header_html(ctx, oob=True)
|
+ root_header_html(ctx, oob=True)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user