Fetch nav-tree fragment from blog, drop local menu_items query
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 46s

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 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-24 11:39:39 +00:00
parent c2f2443d99
commit 2145332cb6
2 changed files with 7 additions and 4 deletions

9
app.py
View File

@@ -2,7 +2,7 @@ from __future__ import annotations
import path_setup # noqa: F401 # adds shared/ to sys.path import path_setup # noqa: F401 # adds shared/ to sys.path
from pathlib import Path from pathlib import Path
from quart import g from quart import g, request
from jinja2 import FileSystemLoader, ChoiceLoader from jinja2 import FileSystemLoader, ChoiceLoader
from shared.infrastructure.factory import create_base_app from shared.infrastructure.factory import create_base_app
@@ -14,12 +14,15 @@ from bp import register_account_bp, register_auth_bp, register_fragments
async def account_context() -> dict: async def account_context() -> dict:
"""Account app context processor.""" """Account app context processor."""
from shared.infrastructure.context import base_context from shared.infrastructure.context import base_context
from shared.services.navigation import get_navigation_tree
from shared.infrastructure.cart_identity import current_cart_identity from shared.infrastructure.cart_identity import current_cart_identity
from shared.infrastructure.fragments import fetch_fragment
ctx = await base_context() ctx = await base_context()
ctx["menu_items"] = await get_navigation_tree(g.s) ctx["nav_tree_html"] = await fetch_fragment(
"blog", "nav-tree",
params={"app_name": "account", "path": request.path},
)
# Cart data (consistent with all other apps) # Cart data (consistent with all other apps)
ident = current_cart_identity() ident = current_cart_identity()

2
shared

Submodule shared updated: 0d40dfaeca...7e650a0ee3