Templates now consume container_nav_html and card_widgets_html from fragment fetches instead of iterating widgets.container_nav / container_cards. OOB nav template renders entry/calendar links directly from data. Calendar and market widget registrations removed (account widgets remain). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
"""Calendar-domain widgets: account pages (tickets & bookings).
|
|
|
|
Container nav and card widgets have been replaced by fragments
|
|
(events app serves them at /internal/fragments/).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from shared.contracts.widgets import AccountPageWidget
|
|
from shared.services.widget_registry import widgets
|
|
from shared.services.registry import services
|
|
|
|
|
|
# -- account pages: tickets & bookings ---------------------------------------
|
|
|
|
async def _tickets_context(session, *, user_id, **kw):
|
|
tickets = await services.calendar.user_tickets(session, user_id=user_id)
|
|
return {"tickets": tickets}
|
|
|
|
|
|
async def _bookings_context(session, *, user_id, **kw):
|
|
bookings = await services.calendar.user_bookings(session, user_id=user_id)
|
|
return {"bookings": bookings}
|
|
|
|
|
|
# -- registration entry point ------------------------------------------------
|
|
|
|
def register_calendar_widgets() -> None:
|
|
widgets.add_account_page(AccountPageWidget(
|
|
domain="calendar",
|
|
slug="tickets",
|
|
label="tickets",
|
|
order=20,
|
|
context_fn=_tickets_context,
|
|
template="_types/auth/_tickets_panel.html",
|
|
))
|
|
widgets.add_account_page(AccountPageWidget(
|
|
domain="calendar",
|
|
slug="bookings",
|
|
label="bookings",
|
|
order=30,
|
|
context_fn=_bookings_context,
|
|
template="_types/auth/_bookings_panel.html",
|
|
))
|