Phase 4: add container-nav/cards fragment handlers, use market fragment
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m4s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m4s
Events provides container-nav (calendar entries + links) and container-cards (batch entries for blog listing) as fragments. Day and entry routes fetch market container-nav via fragment instead of widget registry. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,7 +27,7 @@ from datetime import datetime, timezone
|
||||
import math
|
||||
import logging
|
||||
|
||||
from shared.services.widget_registry import widgets
|
||||
from shared.infrastructure.fragments import fetch_fragment
|
||||
|
||||
from ..ticket_types.routes import register as register_ticket_types
|
||||
|
||||
@@ -222,25 +222,17 @@ def register():
|
||||
ticket_type_id=tt.id,
|
||||
)
|
||||
|
||||
# Widget-driven container nav (market links, etc.)
|
||||
container_nav_loaded = []
|
||||
# Fetch container nav from market (skip calendar — we're on a calendar page)
|
||||
container_nav_html = ""
|
||||
post_data = getattr(g, "post_data", None)
|
||||
if post_data:
|
||||
post_id = post_data["post"]["id"]
|
||||
post_slug = post_data["post"]["slug"]
|
||||
for w in widgets.container_nav:
|
||||
if w.domain.startswith("calendar"):
|
||||
continue # skip — we're already on a calendar page
|
||||
try:
|
||||
wctx = await w.context_fn(
|
||||
g.s, container_type="page", container_id=post_id,
|
||||
post_slug=post_slug,
|
||||
)
|
||||
has_data = any(v for v in wctx.values() if isinstance(v, list) and v)
|
||||
if has_data:
|
||||
container_nav_loaded.append({"widget": w, "ctx": wctx})
|
||||
except Exception:
|
||||
pass
|
||||
container_nav_html = await fetch_fragment("market", "container-nav", params={
|
||||
"container_type": "page",
|
||||
"container_id": str(post_id),
|
||||
"post_slug": post_slug,
|
||||
})
|
||||
|
||||
return {
|
||||
"entry": calendar_entry,
|
||||
@@ -249,7 +241,7 @@ def register():
|
||||
"ticket_sold_count": ticket_sold_count,
|
||||
"user_ticket_count": user_ticket_count,
|
||||
"user_ticket_counts_by_type": user_ticket_counts_by_type,
|
||||
"container_nav_widgets": container_nav_loaded,
|
||||
"container_nav_html": container_nav_html,
|
||||
}
|
||||
@bp.get("/")
|
||||
@require_admin
|
||||
|
||||
Reference in New Issue
Block a user