Merge branch 'worktree-sx-layout-conversion' into macros

# Conflicts:
#	blog/sxc/pages/layouts.py
#	cart/sxc/pages/layouts.py
#	events/sxc/pages/helpers.py
#	events/sxc/pages/layouts.py
#	market/sxc/pages/layouts.py
#	sx/sxc/pages/layouts.py
This commit is contained in:
2026-03-04 22:25:52 +00:00
18 changed files with 1289 additions and 1180 deletions

View File

@@ -1,96 +1,405 @@
;; Events layout defcomps — root header via ~root-header-auto,
;; events-specific headers passed as &key params.
;; Events layout defcomps — fully self-contained via IO primitives.
;; Registered via register_sx_layout in helpers.py.
;; --- Calendar admin layout: root + post + child(admin + cal + cal-admin) ---
;; ---------------------------------------------------------------------------
;; Auto-fetching header macros — calendar, day, entry, slot, tickets
;; ---------------------------------------------------------------------------
(defcomp ~events-cal-admin-layout-full (&key post-header admin-header
calendar-header calendar-admin-header)
(defmacro ~events-calendar-header-auto (oob)
"Calendar header row using (events-calendar-ctx)."
(quasiquote
(let ((__cal (events-calendar-ctx))
(__sc (select-colours)))
(when (get __cal "slug")
(~menu-row-sx :id "calendar-row" :level 3
:link-href (url-for "calendar.get"
:calendar-slug (get __cal "slug"))
:link-label-content (~events-calendar-label
:name (get __cal "name")
:description (get __cal "description"))
:nav (<>
(~nav-link :href (url-for "defpage_slots_listing"
:calendar-slug (get __cal "slug"))
:icon "fa fa-clock" :label "Slots"
:select-colours __sc)
(let ((__rights (app-rights)))
(when (get __rights "admin")
(~nav-link :href (url-for "defpage_calendar_admin"
:calendar-slug (get __cal "slug"))
:icon "fa fa-cog"
:select-colours __sc))))
:child-id "calendar-header-child"
:oob (unquote oob))))))
(defmacro ~events-calendar-admin-header-auto (oob)
"Calendar admin header row."
(quasiquote
(let ((__cal (events-calendar-ctx))
(__sc (select-colours)))
(when (get __cal "slug")
(~menu-row-sx :id "calendar-admin-row" :level 4
:link-label "admin" :icon "fa fa-cog"
:nav (<>
(~nav-link :href (url-for "defpage_slots_listing"
:calendar-slug (get __cal "slug"))
:label "slots" :select-colours __sc)
(~nav-link :href (url-for "calendar.admin.calendar_description_edit"
:calendar-slug (get __cal "slug"))
:label "description" :select-colours __sc))
:child-id "calendar-admin-header-child"
:oob (unquote oob))))))
(defmacro ~events-day-header-auto (oob)
"Day header row using (events-day-ctx)."
(quasiquote
(let ((__day (events-day-ctx))
(__cal (events-calendar-ctx)))
(when (get __day "date-str")
(~menu-row-sx :id "day-row" :level 4
:link-href (url-for "calendar.day.show_day"
:calendar-slug (get __cal "slug")
:year (get __day "year")
:month (get __day "month")
:day (get __day "day"))
:link-label-content (~events-day-label
:date-str (get __day "date-str"))
:nav (get __day "nav")
:child-id "day-header-child"
:oob (unquote oob))))))
(defmacro ~events-day-admin-header-auto (oob)
"Day admin header row."
(quasiquote
(let ((__day (events-day-ctx))
(__cal (events-calendar-ctx)))
(when (get __day "date-str")
(~menu-row-sx :id "day-admin-row" :level 5
:link-href (url-for "defpage_day_admin"
:calendar-slug (get __cal "slug")
:year (get __day "year")
:month (get __day "month")
:day (get __day "day"))
:link-label "admin" :icon "fa fa-cog"
:child-id "day-admin-header-child"
:oob (unquote oob))))))
(defmacro ~events-entry-header-auto (oob)
"Entry header row using (events-entry-ctx)."
(quasiquote
(let ((__ectx (events-entry-ctx)))
(when (get __ectx "id")
(~menu-row-sx :id "entry-row" :level 5
:link-href (get __ectx "link-href")
:link-label-content (~events-entry-label
:entry-id (get __ectx "id")
:title (~events-entry-title :name (get __ectx "name"))
:times (~events-entry-times :time-str (get __ectx "time-str")))
:nav (get __ectx "nav")
:child-id "entry-header-child"
:oob (unquote oob))))))
(defmacro ~events-entry-admin-header-auto (oob)
"Entry admin header row."
(quasiquote
(let ((__ectx (events-entry-ctx)))
(when (get __ectx "id")
(~menu-row-sx :id "entry-admin-row" :level 6
:link-href (get __ectx "admin-href")
:link-label "admin" :icon "fa fa-cog"
:nav (when (get __ectx "is-admin")
(~nav-link :href (get __ectx "ticket-types-href")
:label "ticket_types"
:select-colours (get __ectx "select-colours")))
:child-id "entry-admin-header-child"
:oob (unquote oob))))))
(defmacro ~events-slot-header-auto (oob)
"Slot detail header row using (events-slot-ctx)."
(quasiquote
(let ((__slot (events-slot-ctx)))
(when (get __slot "name")
(~menu-row-sx :id "slot-row" :level 5
:link-label-content (~events-slot-label
:name (get __slot "name")
:description (get __slot "description"))
:child-id "slot-header-child"
:oob (unquote oob))))))
(defmacro ~events-ticket-types-header-auto (oob)
"Ticket types header row."
(quasiquote
(let ((__ectx (events-entry-ctx))
(__cal (events-calendar-ctx)))
(when (get __ectx "id")
(~menu-row-sx :id "ticket_types-row" :level 7
:link-href (get __ectx "ticket-types-href")
:link-label-content (<>
(i :class "fa fa-ticket")
(div :class "shrink-0" "ticket types"))
:nav (~events-admin-placeholder-nav)
:child-id "ticket_type-header-child"
:oob (unquote oob))))))
(defmacro ~events-ticket-type-header-auto (oob)
"Single ticket type header row using (events-ticket-type-ctx)."
(quasiquote
(let ((__tt (events-ticket-type-ctx)))
(when (get __tt "id")
(~menu-row-sx :id "ticket_type-row" :level 8
:link-href (get __tt "link-href")
:link-label-content (div :class "flex flex-col md:flex-row md:gap-2 items-center"
(div :class "flex flex-row items-center gap-2"
(i :class "fa fa-ticket")
(div :class "shrink-0" (get __tt "name"))))
:nav (~events-admin-placeholder-nav)
:child-id "ticket_type-header-child-inner"
:oob (unquote oob))))))
(defmacro ~events-markets-header-auto (oob)
"Markets section header row."
(quasiquote
(~menu-row-sx :id "markets-row" :level 3
:link-href (url-for "defpage_events_markets")
:link-label-content (~events-markets-label)
:child-id "markets-header-child"
:oob (unquote oob))))
;; ---------------------------------------------------------------------------
;; OOB clear helpers — clear deeper header rows not present at this level
;; ---------------------------------------------------------------------------
(defcomp ~events-clear-oob-cal-admin ()
"Clear OOB divs for cal-admin level (keeps down to calendar-admin)."
(<>
(~clear-oob-div :id "entry-admin-row")
(~clear-oob-div :id "entry-admin-header-child")
(~clear-oob-div :id "entry-row")
(~clear-oob-div :id "entry-header-child")
(~clear-oob-div :id "day-admin-row")
(~clear-oob-div :id "day-admin-header-child")
(~clear-oob-div :id "day-row")
(~clear-oob-div :id "day-header-child")
(~clear-oob-div :id "calendars-row")
(~clear-oob-div :id "calendars-header-child")))
(defcomp ~events-clear-oob-slot ()
"Clear OOB divs for slot level."
(<>
(~clear-oob-div :id "entry-admin-row")
(~clear-oob-div :id "entry-admin-header-child")
(~clear-oob-div :id "entry-row")
(~clear-oob-div :id "entry-header-child")
(~clear-oob-div :id "day-admin-row")
(~clear-oob-div :id "day-admin-header-child")
(~clear-oob-div :id "day-row")
(~clear-oob-div :id "day-header-child")
(~clear-oob-div :id "calendars-row")
(~clear-oob-div :id "calendars-header-child")))
(defcomp ~events-clear-oob-day-admin ()
"Clear OOB divs for day-admin level."
(<>
(~clear-oob-div :id "entry-admin-row")
(~clear-oob-div :id "entry-admin-header-child")
(~clear-oob-div :id "entry-row")
(~clear-oob-div :id "entry-header-child")
(~clear-oob-div :id "calendars-row")
(~clear-oob-div :id "calendars-header-child")))
(defcomp ~events-clear-oob-entry ()
"Clear OOB divs for entry level (public, no admin rows)."
(<>
(~clear-oob-div :id "entry-admin-row")
(~clear-oob-div :id "entry-admin-header-child")
(~clear-oob-div :id "day-admin-row")
(~clear-oob-div :id "day-admin-header-child")
(~clear-oob-div :id "calendar-admin-row")
(~clear-oob-div :id "calendar-admin-header-child")
(~clear-oob-div :id "calendars-row")
(~clear-oob-div :id "calendars-header-child")
(~clear-oob-div :id "post-admin-row")
(~clear-oob-div :id "post-admin-header-child")))
(defcomp ~events-clear-oob-entry-admin ()
"Clear OOB divs for entry-admin level."
(<>
(~clear-oob-div :id "calendars-row")
(~clear-oob-div :id "calendars-header-child")))
;; ---------------------------------------------------------------------------
;; Calendar admin layout: root + post + child(post-admin + cal + cal-admin)
;; ---------------------------------------------------------------------------
(defcomp ~events-cal-admin-layout-full ()
(<> (~root-header-auto)
post-header
(~header-child-sx :inner (<> admin-header calendar-header calendar-admin-header))))
(~header-child-sx
:inner (<> (~post-header-auto nil)
(~post-admin-header-auto nil "calendars")
(~events-calendar-header-auto nil)
(~events-calendar-admin-header-auto nil)))))
(defcomp ~events-cal-admin-layout-oob (&key admin-oob cal-oob cal-admin-oob-wrap clear-oob)
(<> admin-oob cal-oob cal-admin-oob-wrap clear-oob))
(defcomp ~events-cal-admin-layout-oob ()
(<> (~post-admin-header-auto true "calendars")
(~events-calendar-header-auto true)
(~oob-header-sx :parent-id "calendar-header-child"
:row (~events-calendar-admin-header-auto nil))
(~events-clear-oob-cal-admin)
(~root-header-auto true)))
;; --- Slots layout: same full as cal-admin ---
;; ---------------------------------------------------------------------------
;; Slots layout: same full as cal-admin
;; ---------------------------------------------------------------------------
(defcomp ~events-slots-layout-oob (&key admin-oob cal-admin-oob clear-oob)
(<> admin-oob cal-admin-oob clear-oob))
;; --- Slot detail layout: root + post + child(admin + cal + cal-admin + slot) ---
(defcomp ~events-slot-layout-full (&key post-header admin-header
calendar-header calendar-admin-header slot-header)
(defcomp ~events-slots-layout-full ()
(<> (~root-header-auto)
post-header
(~header-child-sx :inner (<> admin-header calendar-header calendar-admin-header slot-header))))
(~header-child-sx
:inner (<> (~post-header-auto nil)
(~post-admin-header-auto nil "calendars")
(~events-calendar-header-auto nil)
(~events-calendar-admin-header-auto nil)))))
(defcomp ~events-slot-layout-oob (&key admin-oob cal-admin-oob slot-oob-wrap clear-oob)
(<> admin-oob cal-admin-oob slot-oob-wrap clear-oob))
(defcomp ~events-slots-layout-oob ()
(<> (~post-admin-header-auto true "calendars")
(~events-calendar-admin-header-auto true)
(~events-clear-oob-cal-admin)
(~root-header-auto true)))
;; --- Day admin layout: root + post + child(admin + cal + day + day-admin) ---
;; ---------------------------------------------------------------------------
;; Slot detail layout: root + post + child(admin + cal + cal-admin + slot)
;; ---------------------------------------------------------------------------
(defcomp ~events-day-admin-layout-full (&key post-header admin-header
calendar-header day-header day-admin-header)
(defcomp ~events-slot-layout-full ()
(<> (~root-header-auto)
post-header
(~header-child-sx :inner (<> admin-header calendar-header day-header day-admin-header))))
(~header-child-sx
:inner (<> (~post-header-auto nil)
(~post-admin-header-auto nil "calendars")
(~events-calendar-header-auto nil)
(~events-calendar-admin-header-auto nil)
(~events-slot-header-auto nil)))))
(defcomp ~events-day-admin-layout-oob (&key admin-oob cal-oob day-admin-oob-wrap clear-oob)
(<> admin-oob cal-oob day-admin-oob-wrap clear-oob))
(defcomp ~events-slot-layout-oob ()
(<> (~post-admin-header-auto true "calendars")
(~events-calendar-admin-header-auto true)
(~oob-header-sx :parent-id "calendar-admin-header-child"
:row (~events-slot-header-auto nil))
(~events-clear-oob-slot)
(~root-header-auto true)))
;; --- Entry layout: root + child(post + cal + day + entry) ---
;; ---------------------------------------------------------------------------
;; Day admin layout: root + post + child(admin + cal + day + day-admin)
;; ---------------------------------------------------------------------------
(defcomp ~events-entry-layout-full (&key post-header calendar-header day-header entry-header)
(defcomp ~events-day-admin-layout-full ()
(<> (~root-header-auto)
(~header-child-sx :inner (<> post-header calendar-header day-header entry-header))))
(~header-child-sx
:inner (<> (~post-header-auto nil)
(~post-admin-header-auto nil "calendars")
(~events-calendar-header-auto nil)
(~events-day-header-auto nil)
(~events-day-admin-header-auto nil)))))
(defcomp ~events-entry-layout-oob (&key day-oob entry-oob-wrap clear-oob)
(<> day-oob entry-oob-wrap clear-oob))
(defcomp ~events-day-admin-layout-oob ()
(<> (~post-admin-header-auto true "calendars")
(~events-calendar-header-auto true)
(~oob-header-sx :parent-id "day-header-child"
:row (~events-day-admin-header-auto nil))
(~events-clear-oob-day-admin)
(~root-header-auto true)))
;; --- Entry admin layout: root + post + child(admin + cal + day + entry + entry-admin) ---
;; ---------------------------------------------------------------------------
;; Entry layout: root + child(post + cal + day + entry) — public, no admin
;; ---------------------------------------------------------------------------
(defcomp ~events-entry-admin-layout-full (&key post-header admin-header
calendar-header day-header
entry-header entry-admin-header)
(defcomp ~events-entry-layout-full ()
(<> (~root-header-auto)
post-header
(~header-child-sx :inner (<> admin-header calendar-header day-header
entry-header entry-admin-header))))
(~header-child-sx
:inner (<> (~post-header-auto nil)
(~events-calendar-header-auto nil)
(~events-day-header-auto nil)
(~events-entry-header-auto nil)))))
(defcomp ~events-entry-admin-layout-oob (&key admin-oob entry-oob entry-admin-oob-wrap clear-oob)
(<> admin-oob entry-oob entry-admin-oob-wrap clear-oob))
(defcomp ~events-entry-layout-oob ()
(<> (~events-day-header-auto true)
(~oob-header-sx :parent-id "day-header-child"
:row (~events-entry-header-auto nil))
(~events-clear-oob-entry)
(~root-header-auto true)))
;; --- Ticket types layout: root + child(post + cal + day + entry + entry-admin + ticket-types) ---
;; ---------------------------------------------------------------------------
;; Entry admin layout: root + post + child(admin + cal + day + entry + entry-admin)
;; ---------------------------------------------------------------------------
(defcomp ~events-ticket-types-layout-full (&key post-header calendar-header day-header
entry-header entry-admin-header
ticket-types-header)
(defcomp ~events-entry-admin-layout-full ()
(<> (~root-header-auto)
(~header-child-sx :inner (<> post-header calendar-header day-header
entry-header entry-admin-header ticket-types-header))))
(~header-child-sx
:inner (<> (~post-header-auto nil)
(~post-admin-header-auto nil "calendars")
(~events-calendar-header-auto nil)
(~events-day-header-auto nil)
(~events-entry-header-auto nil)
(~events-entry-admin-header-auto nil)))))
(defcomp ~events-ticket-types-layout-oob (&key entry-admin-oob ticket-types-oob-wrap)
(<> entry-admin-oob ticket-types-oob-wrap))
(defcomp ~events-entry-admin-layout-oob ()
(<> (~post-admin-header-auto true "calendars")
(~events-entry-header-auto true)
(~oob-header-sx :parent-id "entry-header-child"
:row (~events-entry-admin-header-auto nil))
(~events-clear-oob-entry-admin)
(~root-header-auto true)))
;; --- Ticket type detail layout: root + child(post + cal + day + entry + entry-admin + types + type) ---
;; ---------------------------------------------------------------------------
;; Ticket types layout: root + child(post + cal + day + entry + entry-admin + ticket-types)
;; ---------------------------------------------------------------------------
(defcomp ~events-ticket-type-layout-full (&key post-header calendar-header day-header
entry-header entry-admin-header
ticket-types-header ticket-type-header)
(defcomp ~events-ticket-types-layout-full ()
(<> (~root-header-auto)
(~header-child-sx :inner (<> post-header calendar-header day-header
entry-header entry-admin-header
ticket-types-header ticket-type-header))))
(~header-child-sx
:inner (<> (~post-header-auto nil)
(~events-calendar-header-auto nil)
(~events-day-header-auto nil)
(~events-entry-header-auto nil)
(~events-entry-admin-header-auto nil)
(~events-ticket-types-header-auto nil)))))
(defcomp ~events-ticket-type-layout-oob (&key ticket-types-oob ticket-type-oob-wrap)
(<> ticket-types-oob ticket-type-oob-wrap))
(defcomp ~events-ticket-types-layout-oob ()
(<> (~events-entry-admin-header-auto true)
(~oob-header-sx :parent-id "entry-admin-header-child"
:row (~events-ticket-types-header-auto nil))
(~root-header-auto true)))
;; --- Markets layout: root + child(post + markets) ---
;; ---------------------------------------------------------------------------
;; Ticket type layout: all headers down to ticket-type
;; ---------------------------------------------------------------------------
(defcomp ~events-markets-layout-full (&key post-header markets-header)
(defcomp ~events-ticket-type-layout-full ()
(<> (~root-header-auto)
(~header-child-sx :inner (<> post-header markets-header))))
(~header-child-sx
:inner (<> (~post-header-auto nil)
(~events-calendar-header-auto nil)
(~events-day-header-auto nil)
(~events-entry-header-auto nil)
(~events-entry-admin-header-auto nil)
(~events-ticket-types-header-auto nil)
(~events-ticket-type-header-auto nil)))))
(defcomp ~events-markets-layout-oob (&key post-oob markets-oob-wrap)
(<> post-oob markets-oob-wrap))
(defcomp ~events-ticket-type-layout-oob ()
(<> (~events-ticket-types-header-auto true)
(~oob-header-sx :parent-id "ticket_types-header-child"
:row (~events-ticket-type-header-auto nil))
(~root-header-auto true)))
;; ---------------------------------------------------------------------------
;; Markets layout: root + child(post + markets)
;; ---------------------------------------------------------------------------
(defcomp ~events-markets-layout-full ()
(<> (~root-header-auto)
(~header-child-sx
:inner (<> (~post-header-auto nil)
(~events-markets-header-auto nil)))))
(defcomp ~events-markets-layout-oob ()
(<> (~post-header-auto true)
(~oob-header-sx :parent-id "post-header-child"
:row (~events-markets-header-auto nil))
(~root-header-auto true)))

View File

@@ -5,30 +5,22 @@ from typing import Any
from shared.sx.helpers import sx_call
from .utils import _clear_deeper_oob, _ensure_container_nav
from .calendar import (
_post_header_sx, _calendar_header_sx,
_calendar_admin_header_sx, _day_header_sx,
_day_admin_header_sx, _markets_header_sx,
_calendars_main_panel_sx,
_calendar_admin_main_panel_html,
_day_admin_main_panel_html,
_markets_main_panel_html,
)
from .entries import (
_entry_header_html, _entry_main_panel_html,
_entry_main_panel_html,
_entry_nav_html,
_entry_admin_header_html, _entry_admin_main_panel_html,
_entry_admin_main_panel_html,
)
from .tickets import (
_tickets_main_panel_html, _ticket_detail_panel_html,
_ticket_admin_main_panel_html,
_ticket_types_header_html, _ticket_type_header_html,
render_ticket_type_main_panel, render_ticket_types_table,
)
from .slots import (
_slot_header_html, render_slot_main_panel, render_slots_table,
)
from .slots import render_slot_main_panel, render_slots_table
# ---------------------------------------------------------------------------
@@ -43,6 +35,40 @@ def _add_to_defpage_ctx(**kwargs: Any) -> None:
g._defpage_ctx.update(kwargs)
def _ensure_post_defpage_ctx() -> None:
"""Copy g.post_data["post"] into g._defpage_ctx for layout IO primitives."""
from quart import g
post_data = getattr(g, "post_data", None)
if post_data and post_data.get("post"):
_add_to_defpage_ctx(post=post_data["post"])
async def _ensure_container_nav_defpage_ctx() -> None:
"""Fetch container_nav and add to g._defpage_ctx for layout IO primitives."""
from quart import g
dctx = getattr(g, "_defpage_ctx", None) or {}
if dctx.get("container_nav"):
return
post = dctx.get("post") or {}
post_id = post.get("id")
slug = post.get("slug", "")
if not post_id:
return
from shared.infrastructure.fragments import fetch_fragments
current_cal = getattr(g, "calendar_slug", "") or ""
nav_params = {
"container_type": "page",
"container_id": str(post_id),
"post_slug": slug,
"current_calendar": current_cal,
}
events_nav, market_nav = await fetch_fragments([
("events", "container-nav", nav_params),
("market", "container-nav", nav_params),
], required=False)
_add_to_defpage_ctx(container_nav=events_nav + market_nav)
async def _ensure_calendar(calendar_slug: str | None) -> None:
"""Load calendar into g.calendar if not already present."""
from quart import g, abort
@@ -63,6 +89,7 @@ async def _ensure_calendar(calendar_slug: str | None) -> None:
g.calendar = cal
g.calendar_slug = calendar_slug
_add_to_defpage_ctx(calendar=cal)
_ensure_post_defpage_ctx()
async def _ensure_entry(entry_id: int | None) -> None:
@@ -209,265 +236,29 @@ async def _ensure_day_data(year: int, month: int, day: int) -> None:
# ---------------------------------------------------------------------------
# Layouts
# Layouts — all layouts delegate to .sx defcomps via register_sx_layout
# ---------------------------------------------------------------------------
def _register_events_layouts() -> None:
from shared.sx.layouts import register_custom_layout
register_custom_layout("events-calendar-admin", _cal_admin_full, _cal_admin_oob)
register_custom_layout("events-slots", _slots_full, _slots_oob)
register_custom_layout("events-slot", _slot_full, _slot_oob)
register_custom_layout("events-day-admin", _day_admin_full, _day_admin_oob)
register_custom_layout("events-entry", _entry_full, _entry_oob)
register_custom_layout("events-entry-admin", _entry_admin_full, _entry_admin_oob)
register_custom_layout("events-ticket-types", _ticket_types_full, _ticket_types_oob)
register_custom_layout("events-ticket-type", _ticket_type_full, _ticket_type_oob)
register_custom_layout("events-markets", _markets_full, _markets_oob)
# --- Calendar admin layout (root + post + child(post-admin + calendar + cal-admin)) ---
async def _cal_admin_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-cal-admin-layout-full", {},
post_header=await _post_header_sx(ctx),
admin_header=await post_admin_header_sx(ctx, slug, selected="calendars"),
calendar_header=_calendar_header_sx(ctx),
calendar_admin_header=_calendar_admin_header_sx(ctx),
)
async def _cal_admin_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx, oob_header_sx
from shared.sx.parser import SxExpr
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-cal-admin-layout-oob", {},
admin_oob=await post_admin_header_sx(ctx, slug, oob=True, selected="calendars"),
cal_oob=_calendar_header_sx(ctx, oob=True),
cal_admin_oob_wrap=await oob_header_sx("calendar-header-child",
"calendar-admin-header-child", _calendar_admin_header_sx(ctx)),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"post-admin-row", "post-admin-header-child",
"calendar-row", "calendar-header-child",
"calendar-admin-row", "calendar-admin-header-child")),
)
# --- Slots layout (same full as cal-admin but different OOB) ---
async def _slots_full(ctx: dict, **kw: Any) -> str:
return await _cal_admin_full({**ctx, "is_admin_section": True}, **kw)
async def _slots_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx
from shared.sx.parser import SxExpr
ctx = await _ensure_container_nav({**ctx, "is_admin_section": True})
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-slots-layout-oob", {},
admin_oob=await post_admin_header_sx(ctx, slug, oob=True, selected="calendars"),
cal_admin_oob=_calendar_admin_header_sx(ctx, oob=True),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"post-admin-row", "post-admin-header-child",
"calendar-row", "calendar-header-child",
"calendar-admin-row", "calendar-admin-header-child")),
)
# --- Slot detail layout (extends cal-admin with slot header) ---
async def _slot_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx
ctx = await _ensure_container_nav({**ctx, "is_admin_section": True})
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-slot-layout-full", {},
post_header=await _post_header_sx(ctx),
admin_header=await post_admin_header_sx(ctx, slug, selected="calendars"),
calendar_header=_calendar_header_sx(ctx),
calendar_admin_header=_calendar_admin_header_sx(ctx),
slot_header=_slot_header_html(ctx),
)
async def _slot_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx, oob_header_sx
from shared.sx.parser import SxExpr
ctx = await _ensure_container_nav({**ctx, "is_admin_section": True})
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-slot-layout-oob", {},
admin_oob=await post_admin_header_sx(ctx, slug, oob=True, selected="calendars"),
cal_admin_oob=_calendar_admin_header_sx(ctx, oob=True),
slot_oob_wrap=await oob_header_sx("calendar-admin-header-child",
"slot-header-child", _slot_header_html(ctx)),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"post-admin-row", "post-admin-header-child",
"calendar-row", "calendar-header-child",
"calendar-admin-row", "calendar-admin-header-child",
"slot-row", "slot-header-child")),
)
# --- Day admin layout (root + post + post-admin + child(cal + day + day-admin)) ---
async def _day_admin_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-day-admin-layout-full", {},
post_header=await _post_header_sx(ctx),
admin_header=await post_admin_header_sx(ctx, slug, selected="calendars"),
calendar_header=_calendar_header_sx(ctx),
day_header=_day_header_sx(ctx),
day_admin_header=_day_admin_header_sx(ctx),
)
async def _day_admin_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx, oob_header_sx
from shared.sx.parser import SxExpr
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-day-admin-layout-oob", {},
admin_oob=await post_admin_header_sx(ctx, slug, oob=True, selected="calendars"),
cal_oob=_calendar_header_sx(ctx, oob=True),
day_admin_oob_wrap=await oob_header_sx("day-header-child",
"day-admin-header-child", _day_admin_header_sx(ctx)),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"post-admin-row", "post-admin-header-child",
"calendar-row", "calendar-header-child",
"day-row", "day-header-child",
"day-admin-row", "day-admin-header-child")),
)
# --- Entry layout (root + child(post + cal + day + entry), + menu) ---
async def _entry_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env
return await render_to_sx_with_env("events-entry-layout-full", {},
post_header=await _post_header_sx(ctx),
calendar_header=_calendar_header_sx(ctx),
day_header=_day_header_sx(ctx),
entry_header=_entry_header_html(ctx),
)
async def _entry_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, oob_header_sx
from shared.sx.parser import SxExpr
return await render_to_sx_with_env("events-entry-layout-oob", {},
day_oob=_day_header_sx(ctx, oob=True),
entry_oob_wrap=await oob_header_sx("day-header-child",
"entry-header-child", _entry_header_html(ctx)),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"calendar-row", "calendar-header-child",
"day-row", "day-header-child",
"entry-row", "entry-header-child")),
)
# --- Entry admin layout (root + post + child(post-admin + cal + day + entry + entry-admin), + menu) ---
async def _entry_admin_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-entry-admin-layout-full", {},
post_header=await _post_header_sx(ctx),
admin_header=await post_admin_header_sx(ctx, slug, selected="calendars"),
calendar_header=_calendar_header_sx(ctx),
day_header=_day_header_sx(ctx),
entry_header=_entry_header_html(ctx),
entry_admin_header=_entry_admin_header_html(ctx),
)
async def _entry_admin_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx, oob_header_sx
from shared.sx.parser import SxExpr
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-entry-admin-layout-oob", {},
admin_oob=await post_admin_header_sx(ctx, slug, oob=True, selected="calendars"),
entry_oob=_entry_header_html(ctx, oob=True),
entry_admin_oob_wrap=await oob_header_sx("entry-header-child",
"entry-admin-header-child", _entry_admin_header_html(ctx)),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"post-admin-row", "post-admin-header-child",
"calendar-row", "calendar-header-child",
"day-row", "day-header-child",
"entry-row", "entry-header-child",
"entry-admin-row", "entry-admin-header-child")),
)
# --- Ticket types layout (extends entry admin with ticket-types header, + menu) ---
async def _ticket_types_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env
return await render_to_sx_with_env("events-ticket-types-layout-full", {},
post_header=await _post_header_sx(ctx),
calendar_header=_calendar_header_sx(ctx),
day_header=_day_header_sx(ctx),
entry_header=_entry_header_html(ctx),
entry_admin_header=_entry_admin_header_html(ctx),
ticket_types_header=_ticket_types_header_html(ctx),
)
async def _ticket_types_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, oob_header_sx
return await render_to_sx_with_env("events-ticket-types-layout-oob", {},
entry_admin_oob=_entry_admin_header_html(ctx, oob=True),
ticket_types_oob_wrap=await oob_header_sx("entry-admin-header-child",
"ticket_types-header-child", _ticket_types_header_html(ctx)),
)
# --- Ticket type detail layout (extends ticket types with ticket-type header, + menu) ---
async def _ticket_type_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env
return await render_to_sx_with_env("events-ticket-type-layout-full", {},
post_header=await _post_header_sx(ctx),
calendar_header=_calendar_header_sx(ctx),
day_header=_day_header_sx(ctx),
entry_header=_entry_header_html(ctx),
entry_admin_header=_entry_admin_header_html(ctx),
ticket_types_header=_ticket_types_header_html(ctx),
ticket_type_header=_ticket_type_header_html(ctx),
)
async def _ticket_type_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, oob_header_sx
return await render_to_sx_with_env("events-ticket-type-layout-oob", {},
ticket_types_oob=_ticket_types_header_html(ctx, oob=True),
ticket_type_oob_wrap=await oob_header_sx("ticket_types-header-child",
"ticket_type-header-child", _ticket_type_header_html(ctx)),
)
# --- Markets layout (root + child(post + markets)) ---
async def _markets_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env
return await render_to_sx_with_env("events-markets-layout-full", {},
post_header=await _post_header_sx(ctx),
markets_header=_markets_header_sx(ctx),
)
async def _markets_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, oob_header_sx
return await render_to_sx_with_env("events-markets-layout-oob", {},
post_oob=await _post_header_sx(ctx, oob=True),
markets_oob_wrap=await oob_header_sx("post-header-child",
"markets-header-child", _markets_header_sx(ctx)),
)
from shared.sx.layouts import register_sx_layout
register_sx_layout("events-calendar-admin",
"events-cal-admin-layout-full", "events-cal-admin-layout-oob")
register_sx_layout("events-slots",
"events-slots-layout-full", "events-slots-layout-oob")
register_sx_layout("events-slot",
"events-slot-layout-full", "events-slot-layout-oob")
register_sx_layout("events-day-admin",
"events-day-admin-layout-full", "events-day-admin-layout-oob")
register_sx_layout("events-entry",
"events-entry-layout-full", "events-entry-layout-oob")
register_sx_layout("events-entry-admin",
"events-entry-admin-layout-full", "events-entry-admin-layout-oob")
register_sx_layout("events-ticket-types",
"events-ticket-types-layout-full", "events-ticket-types-layout-oob")
register_sx_layout("events-ticket-type",
"events-ticket-type-layout-full", "events-ticket-type-layout-oob")
register_sx_layout("events-markets",
"events-markets-layout-full", "events-markets-layout-oob")
# ---------------------------------------------------------------------------
@@ -497,6 +288,7 @@ def _register_events_helpers() -> None:
async def _h_calendar_admin_content(calendar_slug=None, **kw):
await _ensure_calendar(calendar_slug)
await _ensure_container_nav_defpage_ctx()
from shared.sx.page import get_template_context
ctx = await get_template_context()
return _calendar_admin_main_panel_html(ctx)
@@ -504,6 +296,7 @@ async def _h_calendar_admin_content(calendar_slug=None, **kw):
async def _h_day_admin_content(calendar_slug=None, year=None, month=None, day=None, **kw):
await _ensure_calendar(calendar_slug)
await _ensure_container_nav_defpage_ctx()
if year is not None:
await _ensure_day_data(int(year), int(month), int(day))
return _day_admin_main_panel_html({})
@@ -512,6 +305,7 @@ async def _h_day_admin_content(calendar_slug=None, year=None, month=None, day=No
async def _h_slots_content(calendar_slug=None, **kw):
from quart import g
await _ensure_calendar(calendar_slug)
await _ensure_container_nav_defpage_ctx()
calendar = getattr(g, "calendar", None)
from bp.slots.services.slots import list_slots as svc_list_slots
slots = await svc_list_slots(g.s, calendar.id) if calendar else []
@@ -522,6 +316,7 @@ async def _h_slots_content(calendar_slug=None, **kw):
async def _h_slot_content(calendar_slug=None, slot_id=None, **kw):
from quart import g, abort
await _ensure_calendar(calendar_slug)
await _ensure_container_nav_defpage_ctx()
from bp.slot.services.slot import get_slot as svc_get_slot
slot = await svc_get_slot(g.s, slot_id) if slot_id else None
if not slot:
@@ -550,6 +345,7 @@ async def _h_entry_menu(calendar_slug=None, entry_id=None, **kw):
async def _h_entry_admin_content(calendar_slug=None, entry_id=None, **kw):
await _ensure_calendar(calendar_slug)
await _ensure_container_nav_defpage_ctx()
await _ensure_entry_context(entry_id)
from shared.sx.page import get_template_context
ctx = await get_template_context()
@@ -666,6 +462,7 @@ async def _h_ticket_admin_content(**kw):
async def _h_markets_content(**kw):
_ensure_post_defpage_ctx()
from shared.sx.page import get_template_context
ctx = await get_template_context()
return _markets_main_panel_html(ctx)

View File

@@ -1,277 +0,0 @@
"""Layout registration + header builders."""
from __future__ import annotations
from typing import Any
from shared.sx.parser import SxExpr
from .utils import _clear_deeper_oob, _ensure_container_nav
from .calendar import (
_post_header_sx, _calendar_header_sx, _calendar_admin_header_sx,
_day_header_sx, _day_admin_header_sx, _markets_header_sx,
)
from .entries import _entry_header_html, _entry_admin_header_html
from .slots import _slot_header_html
from .tickets import _ticket_types_header_html, _ticket_type_header_html
# ---------------------------------------------------------------------------
# Layouts
# ---------------------------------------------------------------------------
def _register_events_layouts() -> None:
from shared.sx.layouts import register_custom_layout
register_custom_layout("events-calendar-admin", _cal_admin_full, _cal_admin_oob)
register_custom_layout("events-slots", _slots_full, _slots_oob)
register_custom_layout("events-slot", _slot_full, _slot_oob)
register_custom_layout("events-day-admin", _day_admin_full, _day_admin_oob)
register_custom_layout("events-entry", _entry_full, _entry_oob)
register_custom_layout("events-entry-admin", _entry_admin_full, _entry_admin_oob)
register_custom_layout("events-ticket-types", _ticket_types_full, _ticket_types_oob)
register_custom_layout("events-ticket-type", _ticket_type_full, _ticket_type_oob)
register_custom_layout("events-markets", _markets_full, _markets_oob)
# --- Calendar admin layout (root + post + child(post-admin + calendar + cal-admin)) ---
async def _cal_admin_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-cal-admin-layout-full", {},
post_header=await _post_header_sx(ctx),
admin_header=await post_admin_header_sx(ctx, slug, selected="calendars"),
calendar_header=_calendar_header_sx(ctx),
calendar_admin_header=_calendar_admin_header_sx(ctx),
)
async def _cal_admin_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx, oob_header_sx
from shared.sx.parser import SxExpr
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-cal-admin-layout-oob", {},
admin_oob=await post_admin_header_sx(ctx, slug, oob=True, selected="calendars"),
cal_oob=_calendar_header_sx(ctx, oob=True),
cal_admin_oob_wrap=await oob_header_sx("calendar-header-child",
"calendar-admin-header-child", _calendar_admin_header_sx(ctx)),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"post-admin-row", "post-admin-header-child",
"calendar-row", "calendar-header-child",
"calendar-admin-row", "calendar-admin-header-child")),
)
# --- Slots layout (same full as cal-admin but different OOB) ---
async def _slots_full(ctx: dict, **kw: Any) -> str:
return await _cal_admin_full({**ctx, "is_admin_section": True}, **kw)
async def _slots_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx
from shared.sx.parser import SxExpr
ctx = await _ensure_container_nav({**ctx, "is_admin_section": True})
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-slots-layout-oob", {},
admin_oob=await post_admin_header_sx(ctx, slug, oob=True, selected="calendars"),
cal_admin_oob=_calendar_admin_header_sx(ctx, oob=True),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"post-admin-row", "post-admin-header-child",
"calendar-row", "calendar-header-child",
"calendar-admin-row", "calendar-admin-header-child")),
)
# --- Slot detail layout (extends cal-admin with slot header) ---
async def _slot_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx
ctx = await _ensure_container_nav({**ctx, "is_admin_section": True})
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-slot-layout-full", {},
post_header=await _post_header_sx(ctx),
admin_header=await post_admin_header_sx(ctx, slug, selected="calendars"),
calendar_header=_calendar_header_sx(ctx),
calendar_admin_header=_calendar_admin_header_sx(ctx),
slot_header=_slot_header_html(ctx),
)
async def _slot_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx, oob_header_sx
from shared.sx.parser import SxExpr
ctx = await _ensure_container_nav({**ctx, "is_admin_section": True})
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-slot-layout-oob", {},
admin_oob=await post_admin_header_sx(ctx, slug, oob=True, selected="calendars"),
cal_admin_oob=_calendar_admin_header_sx(ctx, oob=True),
slot_oob_wrap=await oob_header_sx("calendar-admin-header-child",
"slot-header-child", _slot_header_html(ctx)),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"post-admin-row", "post-admin-header-child",
"calendar-row", "calendar-header-child",
"calendar-admin-row", "calendar-admin-header-child",
"slot-row", "slot-header-child")),
)
# --- Day admin layout (root + post + post-admin + child(cal + day + day-admin)) ---
async def _day_admin_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-day-admin-layout-full", {},
post_header=await _post_header_sx(ctx),
admin_header=await post_admin_header_sx(ctx, slug, selected="calendars"),
calendar_header=_calendar_header_sx(ctx),
day_header=_day_header_sx(ctx),
day_admin_header=_day_admin_header_sx(ctx),
)
async def _day_admin_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx, oob_header_sx
from shared.sx.parser import SxExpr
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-day-admin-layout-oob", {},
admin_oob=await post_admin_header_sx(ctx, slug, oob=True, selected="calendars"),
cal_oob=_calendar_header_sx(ctx, oob=True),
day_admin_oob_wrap=await oob_header_sx("day-header-child",
"day-admin-header-child", _day_admin_header_sx(ctx)),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"post-admin-row", "post-admin-header-child",
"calendar-row", "calendar-header-child",
"day-row", "day-header-child",
"day-admin-row", "day-admin-header-child")),
)
# --- Entry layout (root + child(post + cal + day + entry), + menu) ---
async def _entry_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env
return await render_to_sx_with_env("events-entry-layout-full", {},
post_header=await _post_header_sx(ctx),
calendar_header=_calendar_header_sx(ctx),
day_header=_day_header_sx(ctx),
entry_header=_entry_header_html(ctx),
)
async def _entry_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, oob_header_sx
from shared.sx.parser import SxExpr
return await render_to_sx_with_env("events-entry-layout-oob", {},
day_oob=_day_header_sx(ctx, oob=True),
entry_oob_wrap=await oob_header_sx("day-header-child",
"entry-header-child", _entry_header_html(ctx)),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"calendar-row", "calendar-header-child",
"day-row", "day-header-child",
"entry-row", "entry-header-child")),
)
# --- Entry admin layout (root + post + child(post-admin + cal + day + entry + entry-admin), + menu) ---
async def _entry_admin_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-entry-admin-layout-full", {},
post_header=await _post_header_sx(ctx),
admin_header=await post_admin_header_sx(ctx, slug, selected="calendars"),
calendar_header=_calendar_header_sx(ctx),
day_header=_day_header_sx(ctx),
entry_header=_entry_header_html(ctx),
entry_admin_header=_entry_admin_header_html(ctx),
)
async def _entry_admin_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, post_admin_header_sx, oob_header_sx
from shared.sx.parser import SxExpr
ctx = await _ensure_container_nav(ctx)
slug = (ctx.get("post") or {}).get("slug", "")
return await render_to_sx_with_env("events-entry-admin-layout-oob", {},
admin_oob=await post_admin_header_sx(ctx, slug, oob=True, selected="calendars"),
entry_oob=_entry_header_html(ctx, oob=True),
entry_admin_oob_wrap=await oob_header_sx("entry-header-child",
"entry-admin-header-child", _entry_admin_header_html(ctx)),
clear_oob=SxExpr(_clear_deeper_oob("post-row", "post-header-child",
"post-admin-row", "post-admin-header-child",
"calendar-row", "calendar-header-child",
"day-row", "day-header-child",
"entry-row", "entry-header-child",
"entry-admin-row", "entry-admin-header-child")),
)
# --- Ticket types layout (extends entry admin with ticket-types header, + menu) ---
async def _ticket_types_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env
return await render_to_sx_with_env("events-ticket-types-layout-full", {},
post_header=await _post_header_sx(ctx),
calendar_header=_calendar_header_sx(ctx),
day_header=_day_header_sx(ctx),
entry_header=_entry_header_html(ctx),
entry_admin_header=_entry_admin_header_html(ctx),
ticket_types_header=_ticket_types_header_html(ctx),
)
async def _ticket_types_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, oob_header_sx
return await render_to_sx_with_env("events-ticket-types-layout-oob", {},
entry_admin_oob=_entry_admin_header_html(ctx, oob=True),
ticket_types_oob_wrap=await oob_header_sx("entry-admin-header-child",
"ticket_types-header-child", _ticket_types_header_html(ctx)),
)
# --- Ticket type detail layout (extends ticket types with ticket-type header, + menu) ---
async def _ticket_type_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env
return await render_to_sx_with_env("events-ticket-type-layout-full", {},
post_header=await _post_header_sx(ctx),
calendar_header=_calendar_header_sx(ctx),
day_header=_day_header_sx(ctx),
entry_header=_entry_header_html(ctx),
entry_admin_header=_entry_admin_header_html(ctx),
ticket_types_header=_ticket_types_header_html(ctx),
ticket_type_header=_ticket_type_header_html(ctx),
)
async def _ticket_type_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, oob_header_sx
return await render_to_sx_with_env("events-ticket-type-layout-oob", {},
ticket_types_oob=_ticket_types_header_html(ctx, oob=True),
ticket_type_oob_wrap=await oob_header_sx("ticket_types-header-child",
"ticket_type-header-child", _ticket_type_header_html(ctx)),
)
# --- Markets layout (root + child(post + markets)) ---
async def _markets_full(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env
return await render_to_sx_with_env("events-markets-layout-full", {},
post_header=await _post_header_sx(ctx),
markets_header=_markets_header_sx(ctx),
)
async def _markets_oob(ctx: dict, **kw: Any) -> str:
from shared.sx.helpers import render_to_sx_with_env, oob_header_sx
return await render_to_sx_with_env("events-markets-layout-oob", {},
post_oob=await _post_header_sx(ctx, oob=True),
markets_oob_wrap=await oob_header_sx("post-header-child",
"markets-header-child", _markets_header_sx(ctx)),
)