From e0046403d8eefb159b644460d164c355918342c0 Mon Sep 17 00:00:00 2001 From: giles Date: Tue, 24 Feb 2026 11:39:39 +0000 Subject: [PATCH] Fetch nav-tree fragment from blog, drop local menu_items query Navigation is now rendered by blog as an HTML fragment. This app fetches it with its own app_name and path for correct highlighting. Co-Authored-By: Claude Opus 4.6 --- app.py | 13 ++++++++----- shared | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 6ed7ad4..1861d92 100644 --- a/app.py +++ b/app.py @@ -4,7 +4,7 @@ import path_setup # noqa: F401 # adds shared/ to sys.path from decimal import Decimal from pathlib import Path -from quart import g, abort +from quart import g, abort, request from jinja2 import FileSystemLoader, ChoiceLoader from sqlalchemy import select @@ -45,16 +45,21 @@ async def cart_context() -> dict: - cart / calendar_cart_entries / total / calendar_total: direct DB (cart app owns this data) - cart_count: derived from cart + calendar entries (for _mini.html) - - menu_items: via shared.services.navigation + - nav_tree_html: fetched from blog as fragment When g.page_post exists, cart and calendar_cart_entries are page-scoped. Global cart_count / cart_total stay global for cart-mini. """ from shared.infrastructure.context import base_context - from shared.services.navigation import get_navigation_tree + from shared.infrastructure.fragments import fetch_fragment ctx = await base_context() + ctx["nav_tree_html"] = await fetch_fragment( + "blog", "nav-tree", + params={"app_name": "cart", "path": request.path}, + ) + # Cart app owns cart data — use g.cart from _load_cart all_cart = getattr(g, "cart", None) or [] all_cal = await get_calendar_cart_entries(g.s) @@ -86,8 +91,6 @@ async def cart_context() -> dict: ctx["calendar_total"] = calendar_total ctx["ticket_total"] = ticket_total - ctx["menu_items"] = await get_navigation_tree(g.s) - return ctx diff --git a/shared b/shared index 0d40dfa..7e650a0 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit 0d40dfaeca7dbdc8adeaf7b071bfd9faccb74511 +Subproject commit 7e650a0ee3a61d56525cc9e298ed0c4194e780a4