Replace 21 Jinja render_template() calls with sx render functions

Phase 1: Wire 16 events routes to existing sx render functions
- slot, slots, ticket_types, ticket_type, calendar_entries,
  calendar_entry, calendar_entry/admin

Phase 2: Orders checkout return (2 calls)
- New orders/sx/checkout.sx with return page components
- New render_checkout_return_page() in orders/sx/sx_components.py

Phase 3: Blog menu items (3 calls)
- New blog/sx/menu_items.sx with search result components
- New render_menu_item_form() and render_page_search_results()
  in blog/sx/sx_components.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 08:52:32 +00:00
parent 5dd1161816
commit 3bd4f4b661
13 changed files with 395 additions and 120 deletions

View File

@@ -265,18 +265,27 @@ def register():
@bp.get("/add/")
async def add_form(day: int, month: int, year: int, **kwargs):
html = await render_template(
"_types/day/_add.html",
)
return await make_response(html)
from datetime import date as date_cls
from sqlalchemy import select as sa_select
from models.calendars import CalendarSlot as _CS
day_date = date_cls(year, month, day)
weekday_attr = ["mon","tue","wed","thu","fri","sat","sun"][day_date.weekday()]
stmt = sa_select(_CS).where(
_CS.calendar_id == g.calendar.id,
getattr(_CS, weekday_attr) == True,
_CS.deleted_at.is_(None),
).order_by(_CS.time_start.asc(), _CS.id.asc())
result = await g.s.execute(stmt)
day_slots = list(result.scalars())
from sx.sx_components import render_entry_add_form
return sx_response(render_entry_add_form(g.calendar, day, month, year, day_slots))
@bp.get("/add-button/")
async def add_button(day: int, month: int, year: int, **kwargs):
html = await render_template(
"_types/day/_add_button.html",
)
return await make_response(html)
from sx.sx_components import render_entry_add_button
return sx_response(render_entry_add_button(g.calendar, day, month, year))