Make SxExpr a str subclass, sx_call/render functions return SxExpr
SxExpr is now a str subclass so it works everywhere a plain string does (join, isinstance, f-strings) while serialize() still emits it unquoted. sx_call() and all internal render functions (_render_to_sx, async_eval_to_sx, etc.) return SxExpr, eliminating the "forgot to wrap" bug class that caused the sx_content leak and list serialization bugs. - Phase 0: SxExpr(str) with .source property, __add__/__radd__ - Phase 1: sx_call returns SxExpr (drop-in, all 200+ sites unchanged) - Phase 2: async_eval_to_sx, async_eval_slot_to_sx, _render_to_sx, mobile_menu_sx return SxExpr; remove isinstance(str) workaround - Phase 3: Remove ~150 redundant SxExpr() wrappings across 45 files - Phase 4: serialize() docstring, handler return docs, ;; returns: sx Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
;; Events account-nav-item fragment handler
|
||||
;; returns: sx
|
||||
;;
|
||||
;; Renders tickets + bookings links for the account dashboard nav.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
;; Account-page fragment handler
|
||||
;; returns: sx
|
||||
;;
|
||||
;; Renders tickets or bookings panel for the account dashboard.
|
||||
;; slug=tickets → ticket list; slug=bookings → booking list.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
;; Container-cards fragment handler
|
||||
;; returns: sx
|
||||
;;
|
||||
;; Returns HTML with <!-- card-widget:ID --> comment markers so the
|
||||
;; blog consumer can split per-post fragments. Each post section
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
;; Events container-nav fragment handler
|
||||
;; returns: sx
|
||||
;;
|
||||
;; Renders calendar entry nav items + calendar link nav items
|
||||
;; for the scrollable navigation panel on blog post pages.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
;; Events link-card fragment handler
|
||||
;; returns: sx
|
||||
;;
|
||||
;; Renders event page preview card(s) by slug.
|
||||
;; Supports single mode (?slug=x) and batch mode (?keys=x,y,z).
|
||||
|
||||
@@ -78,7 +78,7 @@ def _calendars_header_sx(ctx: dict, *, oob: bool = False) -> str:
|
||||
link_href = url_for("calendars.home")
|
||||
return sx_call("menu-row-sx", id="calendars-row", level=3,
|
||||
link_href=link_href,
|
||||
link_label_content=SxExpr(sx_call("events-calendars-label")),
|
||||
link_label_content=sx_call("events-calendars-label"),
|
||||
child_id="calendars-header-child", oob=oob)
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ def _calendar_header_sx(ctx: dict, *, oob: bool = False) -> str:
|
||||
nav_html = _calendar_nav_sx(ctx)
|
||||
|
||||
return sx_call("menu-row-sx", id="calendar-row", level=3,
|
||||
link_href=link_href, link_label_content=SxExpr(label_html),
|
||||
link_href=link_href, link_label_content=label_html,
|
||||
nav=SxExpr(nav_html) if nav_html else None, child_id="calendar-header-child", oob=oob)
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ def _day_header_sx(ctx: dict, *, oob: bool = False) -> str:
|
||||
nav_html = _day_nav_sx(ctx)
|
||||
|
||||
return sx_call("menu-row-sx", id="day-row", level=4,
|
||||
link_href=link_href, link_label_content=SxExpr(label_html),
|
||||
link_href=link_href, link_label_content=label_html,
|
||||
nav=SxExpr(nav_html) if nav_html else None, child_id="day-header-child", oob=oob)
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ def _markets_header_sx(ctx: dict, *, oob: bool = False) -> str:
|
||||
link_href = url_for("defpage_events_markets")
|
||||
return sx_call("menu-row-sx", id="markets-row", level=3,
|
||||
link_href=link_href,
|
||||
link_label_content=SxExpr(sx_call("events-markets-label")),
|
||||
link_label_content=sx_call("events-markets-label"),
|
||||
child_id="markets-header-child", oob=oob)
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@ def _day_row_html(ctx: dict, entry) -> str:
|
||||
state = getattr(entry, "state", "pending") or "pending"
|
||||
state_badge = _entry_state_badge_html(state)
|
||||
state_td = sx_call("events-day-row-state",
|
||||
state_id=f"entry-state-{entry.id}", badge=SxExpr(state_badge))
|
||||
state_id=f"entry-state-{entry.id}", badge=state_badge)
|
||||
|
||||
# Cost
|
||||
cost = getattr(entry, "cost", None)
|
||||
@@ -564,9 +564,9 @@ def _day_row_html(ctx: dict, entry) -> str:
|
||||
actions_td = sx_call("events-day-row-actions")
|
||||
|
||||
return sx_call("events-day-row",
|
||||
tr_cls=tr_cls, name=SxExpr(name_html), slot=SxExpr(slot_html),
|
||||
state=SxExpr(state_td), cost=SxExpr(cost_td),
|
||||
tickets=SxExpr(tickets_td), actions=SxExpr(actions_td))
|
||||
tr_cls=tr_cls, name=name_html, slot=slot_html,
|
||||
state=state_td, cost=cost_td,
|
||||
tickets=tickets_td, actions=actions_td)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -598,7 +598,7 @@ def _calendar_admin_main_panel_html(ctx: dict) -> str:
|
||||
description_html = _calendar_description_display_html(calendar, desc_edit_url)
|
||||
|
||||
return sx_call("events-calendar-admin-panel",
|
||||
description_content=SxExpr(description_html), csrf=csrf,
|
||||
description_content=description_html, csrf=csrf,
|
||||
description=desc)
|
||||
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ def _entry_card_html(entry, page_info: dict, pending_tickets: dict,
|
||||
if tp is not None:
|
||||
qty = pending_tickets.get(entry.id, 0)
|
||||
widget_html = sx_call("events-entry-widget-wrapper",
|
||||
widget=SxExpr(_ticket_widget_html(entry, qty, ticket_url, ctx={})))
|
||||
widget=_ticket_widget_html(entry, qty, ticket_url, ctx={}))
|
||||
|
||||
return sx_call("events-entry-card",
|
||||
title=SxExpr(title_html), badges=SxExpr(badges_html),
|
||||
title=title_html, badges=SxExpr(badges_html),
|
||||
time_parts=SxExpr(time_parts), cost=SxExpr(cost_html),
|
||||
widget=SxExpr(widget_html))
|
||||
|
||||
@@ -137,10 +137,10 @@ def _entry_card_tile_html(entry, page_info: dict, pending_tickets: dict,
|
||||
if tp is not None:
|
||||
qty = pending_tickets.get(entry.id, 0)
|
||||
widget_html = sx_call("events-entry-tile-widget-wrapper",
|
||||
widget=SxExpr(_ticket_widget_html(entry, qty, ticket_url, ctx={})))
|
||||
widget=_ticket_widget_html(entry, qty, ticket_url, ctx={}))
|
||||
|
||||
return sx_call("events-entry-card-tile",
|
||||
title=SxExpr(title_html), badges=SxExpr(badges_html),
|
||||
title=title_html, badges=SxExpr(badges_html),
|
||||
time=SxExpr(time_html), cost=SxExpr(cost_html),
|
||||
widget=SxExpr(widget_html))
|
||||
|
||||
@@ -199,7 +199,7 @@ def _events_main_panel_html(ctx: dict, entries, has_more, pending_tickets, page_
|
||||
cls="px-3 py-12 text-center text-stone-400")
|
||||
|
||||
return sx_call("events-main-panel-body",
|
||||
toggle=SxExpr(toggle), body=SxExpr(body))
|
||||
toggle=toggle, body=body)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -253,7 +253,7 @@ def _entry_main_panel_html(ctx: dict) -> str:
|
||||
# State
|
||||
state_html = _field("State", sx_call("events-entry-state-field",
|
||||
entry_id=str(eid),
|
||||
badge=SxExpr(_entry_state_badge_html(state))))
|
||||
badge=_entry_state_badge_html(state)))
|
||||
|
||||
# Cost
|
||||
cost = getattr(entry, "cost", None)
|
||||
@@ -284,7 +284,7 @@ def _entry_main_panel_html(ctx: dict) -> str:
|
||||
entry_posts = ctx.get("entry_posts") or []
|
||||
posts_html = _field("Associated Posts", sx_call("events-entry-posts-field",
|
||||
entry_id=str(eid),
|
||||
posts_panel=SxExpr(render_entry_posts_panel(entry_posts, entry, calendar, day, month, year))))
|
||||
posts_panel=render_entry_posts_panel(entry_posts, entry, calendar, day, month, year)))
|
||||
|
||||
# Options and Edit Button
|
||||
edit_url = url_for(
|
||||
@@ -295,12 +295,12 @@ def _entry_main_panel_html(ctx: dict) -> str:
|
||||
|
||||
return sx_call("events-entry-panel",
|
||||
entry_id=str(eid), list_container=list_container,
|
||||
name=SxExpr(name_html), slot=SxExpr(slot_html),
|
||||
time=SxExpr(time_html), state=SxExpr(state_html),
|
||||
cost=SxExpr(cost_html), tickets=SxExpr(tickets_html),
|
||||
buy=SxExpr(buy_html), date=SxExpr(date_html),
|
||||
posts=SxExpr(posts_html),
|
||||
options=SxExpr(_entry_options_html(entry, calendar, day, month, year)),
|
||||
name=name_html, slot=slot_html,
|
||||
time=time_html, state=state_html,
|
||||
cost=cost_html, tickets=tickets_html,
|
||||
buy=SxExpr(buy_html), date=date_html,
|
||||
posts=posts_html,
|
||||
options=_entry_options_html(entry, calendar, day, month, year),
|
||||
pre_action=pre_action, edit_url=edit_url)
|
||||
|
||||
|
||||
@@ -331,13 +331,13 @@ def _entry_header_html(ctx: dict, *, oob: bool = False) -> str:
|
||||
)
|
||||
label_html = sx_call("events-entry-label",
|
||||
entry_id=str(entry.id),
|
||||
title=SxExpr(_entry_title_html(entry)),
|
||||
title=_entry_title_html(entry),
|
||||
times=SxExpr(_entry_times_html(entry)))
|
||||
|
||||
nav_html = _entry_nav_html(ctx)
|
||||
|
||||
return sx_call("menu-row-sx", id="entry-row", level=5,
|
||||
link_href=link_href, link_label_content=SxExpr(label_html),
|
||||
link_href=link_href, link_label_content=label_html,
|
||||
nav=SxExpr(nav_html) if nav_html else None, child_id="entry-header-child", oob=oob)
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ def _entry_nav_html(ctx: dict) -> str:
|
||||
else:
|
||||
img_html = sx_call("events-post-img-placeholder")
|
||||
post_links += sx_call("events-entry-nav-post-link",
|
||||
href=href, img=SxExpr(img_html), title=title)
|
||||
href=href, img=img_html, title=title)
|
||||
parts.append((sx_call("events-entry-posts-nav-oob",
|
||||
items=SxExpr(post_links))).replace(' :hx-swap-oob "true"', ''))
|
||||
|
||||
@@ -420,7 +420,7 @@ def render_entry_optioned(entry, calendar, day, month, year) -> str:
|
||||
|
||||
return options + sx_call("events-entry-optioned-oob",
|
||||
entry_id=str(entry.id),
|
||||
title=SxExpr(title), state=SxExpr(state))
|
||||
title=title, state=state)
|
||||
|
||||
|
||||
def _entry_title_html(entry) -> str:
|
||||
@@ -428,7 +428,7 @@ def _entry_title_html(entry) -> str:
|
||||
state = getattr(entry, "state", "pending") or "pending"
|
||||
return sx_call("events-entry-title",
|
||||
name=entry.name,
|
||||
badge=SxExpr(_entry_state_badge_html(state)))
|
||||
badge=_entry_state_badge_html(state))
|
||||
|
||||
|
||||
def _entry_options_html(entry, calendar, day, month, year) -> str:
|
||||
@@ -550,7 +550,7 @@ def render_entry_posts_panel(entry_posts, entry, calendar, day, month, year) ->
|
||||
entry_id=eid, post_id=ep_id,
|
||||
)
|
||||
items += sx_call("events-entry-post-item",
|
||||
img=SxExpr(img_html), title=ep_title,
|
||||
img=img_html, title=ep_title,
|
||||
del_url=del_url, entry_id=eid_s,
|
||||
csrf_hdr=f'{{"X-CSRFToken": "{csrf}"}}')
|
||||
posts_html = sx_call("events-entry-posts-list", items=SxExpr(items))
|
||||
@@ -563,7 +563,7 @@ def render_entry_posts_panel(entry_posts, entry, calendar, day, month, year) ->
|
||||
)
|
||||
|
||||
return sx_call("events-entry-posts-panel",
|
||||
posts=SxExpr(posts_html), search_url=search_url,
|
||||
posts=posts_html, search_url=search_url,
|
||||
entry_id=eid_s)
|
||||
|
||||
|
||||
@@ -591,7 +591,7 @@ def render_entry_posts_nav_oob(entry_posts) -> str:
|
||||
if feat else sx_call("events-post-img-placeholder"))
|
||||
items += sx_call("events-entry-nav-post",
|
||||
href=href, nav_btn=nav_btn,
|
||||
img=SxExpr(img_html), title=title)
|
||||
img=img_html, title=title)
|
||||
|
||||
return sx_call("events-entry-posts-nav-oob", items=SxExpr(items))
|
||||
|
||||
@@ -743,7 +743,7 @@ def _entry_admin_header_html(ctx: dict, *, oob: bool = False) -> str:
|
||||
|
||||
return sx_call("menu-row-sx", id="entry-admin-row", level=6,
|
||||
link_href=link_href, link_label="admin", icon="fa fa-cog",
|
||||
nav=SxExpr(nav_html) if nav_html else None, child_id="entry-admin-header-child", oob=oob)
|
||||
nav=nav_html or None, child_id="entry-admin-header-child", oob=oob)
|
||||
|
||||
|
||||
def _entry_admin_nav_html(ctx: dict) -> str:
|
||||
@@ -822,7 +822,7 @@ def render_post_search_results(search_posts, search_query, page, total_pages,
|
||||
|
||||
parts.append(sx_call("events-post-search-item",
|
||||
post_url=post_url, entry_id=str(eid), csrf=csrf,
|
||||
post_id=str(sp.id), img=SxExpr(img_html), title=title))
|
||||
post_id=str(sp.id), img=img_html, title=title))
|
||||
|
||||
result = "".join(parts)
|
||||
|
||||
@@ -882,7 +882,7 @@ def render_entry_edit_form(entry, calendar, day, month, year, day_slots) -> str:
|
||||
html = sx_call("events-entry-edit-form",
|
||||
entry_id=str(eid), list_container=list_container,
|
||||
put_url=put_url, cancel_url=cancel_url, csrf=csrf,
|
||||
name_val=entry.name or "", slot_picker=SxExpr(slot_picker_html),
|
||||
name_val=entry.name or "", slot_picker=slot_picker_html,
|
||||
start_val=start_val, end_val=end_val, cost_display=cost_display,
|
||||
ticket_price_val=tp_val, ticket_count_val=tc_val,
|
||||
action_btn=action_btn, cancel_btn=cancel_btn)
|
||||
@@ -920,7 +920,7 @@ def render_entry_add_form(calendar, day, month, year, day_slots) -> str:
|
||||
|
||||
html = sx_call("events-entry-add-form",
|
||||
post_url=post_url, csrf=csrf,
|
||||
slot_picker=SxExpr(slot_picker_html),
|
||||
slot_picker=slot_picker_html,
|
||||
action_btn=action_btn, cancel_btn=cancel_btn,
|
||||
cancel_url=cancel_url)
|
||||
return html + _SLOT_PICKER_JS
|
||||
@@ -998,13 +998,13 @@ def render_fragment_account_tickets(tickets) -> str:
|
||||
items_html += sx_call("events-frag-ticket-item",
|
||||
href=href, entry_name=ticket.entry_name,
|
||||
date_str=date_str, calendar_name=cal_name,
|
||||
type_name=type_name, badge=SxExpr(badge_html))
|
||||
type_name=type_name, badge=badge_html)
|
||||
body = sx_call("events-frag-tickets-list", items=SxExpr(items_html))
|
||||
else:
|
||||
body = sx_call("empty-state", message="No tickets yet.",
|
||||
cls="text-sm text-stone-500")
|
||||
|
||||
return sx_call("events-frag-tickets-panel", items=SxExpr(body))
|
||||
return sx_call("events-frag-tickets-panel", items=body)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -1033,10 +1033,10 @@ def render_fragment_account_bookings(bookings) -> str:
|
||||
name=booking.name,
|
||||
date_str=date_str + date_str_extra,
|
||||
calendar_name=cal_name, cost_str=cost_str,
|
||||
badge=SxExpr(badge_html))
|
||||
badge=badge_html)
|
||||
body = sx_call("events-frag-bookings-list", items=SxExpr(items_html))
|
||||
else:
|
||||
body = sx_call("empty-state", message="No bookings yet.",
|
||||
cls="text-sm text-stone-500")
|
||||
|
||||
return sx_call("events-frag-bookings-panel", items=SxExpr(body))
|
||||
return sx_call("events-frag-bookings-panel", items=body)
|
||||
|
||||
@@ -229,14 +229,13 @@ def _register_events_layouts() -> None:
|
||||
|
||||
async def _cal_admin_full(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)
|
||||
slug = (ctx.get("post") or {}).get("slug", "")
|
||||
return await render_to_sx_with_env("events-cal-admin-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
admin_header=SxExpr(await post_admin_header_sx(ctx, slug, selected="calendars")),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
calendar_admin_header=SxExpr(_calendar_admin_header_sx(ctx)),
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -246,10 +245,10 @@ async def _cal_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
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=SxExpr(await post_admin_header_sx(ctx, slug, oob=True, selected="calendars")),
|
||||
cal_oob=SxExpr(_calendar_header_sx(ctx, oob=True)),
|
||||
cal_admin_oob_wrap=SxExpr(await oob_header_sx("calendar-header-child",
|
||||
"calendar-admin-header-child", _calendar_admin_header_sx(ctx))),
|
||||
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",
|
||||
@@ -269,8 +268,8 @@ async def _slots_oob(ctx: dict, **kw: Any) -> str:
|
||||
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=SxExpr(await post_admin_header_sx(ctx, slug, oob=True, selected="calendars")),
|
||||
cal_admin_oob=SxExpr(_calendar_admin_header_sx(ctx, oob=True)),
|
||||
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",
|
||||
@@ -282,15 +281,14 @@ async def _slots_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _slot_full(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-slot-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
admin_header=SxExpr(await post_admin_header_sx(ctx, slug, selected="calendars")),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
calendar_admin_header=SxExpr(_calendar_admin_header_sx(ctx)),
|
||||
slot_header=SxExpr(_slot_header_html(ctx)),
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -300,10 +298,10 @@ async def _slot_oob(ctx: dict, **kw: Any) -> str:
|
||||
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=SxExpr(await post_admin_header_sx(ctx, slug, oob=True, selected="calendars")),
|
||||
cal_admin_oob=SxExpr(_calendar_admin_header_sx(ctx, oob=True)),
|
||||
slot_oob_wrap=SxExpr(await oob_header_sx("calendar-admin-header-child",
|
||||
"slot-header-child", _slot_header_html(ctx))),
|
||||
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",
|
||||
@@ -316,15 +314,14 @@ async def _slot_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _day_admin_full(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)
|
||||
slug = (ctx.get("post") or {}).get("slug", "")
|
||||
return await render_to_sx_with_env("events-day-admin-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
admin_header=SxExpr(await post_admin_header_sx(ctx, slug, selected="calendars")),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
day_header=SxExpr(_day_header_sx(ctx)),
|
||||
day_admin_header=SxExpr(_day_admin_header_sx(ctx)),
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -334,10 +331,10 @@ async def _day_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
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=SxExpr(await post_admin_header_sx(ctx, slug, oob=True, selected="calendars")),
|
||||
cal_oob=SxExpr(_calendar_header_sx(ctx, oob=True)),
|
||||
day_admin_oob_wrap=SxExpr(await oob_header_sx("day-header-child",
|
||||
"day-admin-header-child", _day_admin_header_sx(ctx))),
|
||||
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",
|
||||
@@ -350,12 +347,11 @@ async def _day_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _entry_full(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import render_to_sx_with_env
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-entry-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
day_header=SxExpr(_day_header_sx(ctx)),
|
||||
entry_header=SxExpr(_entry_header_html(ctx)),
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -363,9 +359,9 @@ 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=SxExpr(_day_header_sx(ctx, oob=True)),
|
||||
entry_oob_wrap=SxExpr(await oob_header_sx("day-header-child",
|
||||
"entry-header-child", _entry_header_html(ctx))),
|
||||
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",
|
||||
@@ -377,16 +373,15 @@ async def _entry_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _entry_admin_full(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)
|
||||
slug = (ctx.get("post") or {}).get("slug", "")
|
||||
return await render_to_sx_with_env("events-entry-admin-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
admin_header=SxExpr(await post_admin_header_sx(ctx, slug, selected="calendars")),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
day_header=SxExpr(_day_header_sx(ctx)),
|
||||
entry_header=SxExpr(_entry_header_html(ctx)),
|
||||
entry_admin_header=SxExpr(_entry_admin_header_html(ctx)),
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -396,10 +391,10 @@ async def _entry_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
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=SxExpr(await post_admin_header_sx(ctx, slug, oob=True, selected="calendars")),
|
||||
entry_oob=SxExpr(_entry_header_html(ctx, oob=True)),
|
||||
entry_admin_oob_wrap=SxExpr(await oob_header_sx("entry-header-child",
|
||||
"entry-admin-header-child", _entry_admin_header_html(ctx))),
|
||||
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",
|
||||
@@ -413,24 +408,22 @@ async def _entry_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _ticket_types_full(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import render_to_sx_with_env
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-ticket-types-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
day_header=SxExpr(_day_header_sx(ctx)),
|
||||
entry_header=SxExpr(_entry_header_html(ctx)),
|
||||
entry_admin_header=SxExpr(_entry_admin_header_html(ctx)),
|
||||
ticket_types_header=SxExpr(_ticket_types_header_html(ctx)),
|
||||
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
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-ticket-types-layout-oob", {},
|
||||
entry_admin_oob=SxExpr(_entry_admin_header_html(ctx, oob=True)),
|
||||
ticket_types_oob_wrap=SxExpr(await oob_header_sx("entry-admin-header-child",
|
||||
"ticket_types-header-child", _ticket_types_header_html(ctx))),
|
||||
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)),
|
||||
)
|
||||
|
||||
|
||||
@@ -438,25 +431,23 @@ async def _ticket_types_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _ticket_type_full(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import render_to_sx_with_env
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-ticket-type-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
day_header=SxExpr(_day_header_sx(ctx)),
|
||||
entry_header=SxExpr(_entry_header_html(ctx)),
|
||||
entry_admin_header=SxExpr(_entry_admin_header_html(ctx)),
|
||||
ticket_types_header=SxExpr(_ticket_types_header_html(ctx)),
|
||||
ticket_type_header=SxExpr(_ticket_type_header_html(ctx)),
|
||||
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
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-ticket-type-layout-oob", {},
|
||||
ticket_types_oob=SxExpr(_ticket_types_header_html(ctx, oob=True)),
|
||||
ticket_type_oob_wrap=SxExpr(await oob_header_sx("ticket_types-header-child",
|
||||
"ticket_type-header-child", _ticket_type_header_html(ctx))),
|
||||
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)),
|
||||
)
|
||||
|
||||
|
||||
@@ -464,20 +455,18 @@ async def _ticket_type_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _markets_full(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import render_to_sx_with_env
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-markets-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
markets_header=SxExpr(_markets_header_sx(ctx)),
|
||||
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
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-markets-layout-oob", {},
|
||||
post_oob=SxExpr(await _post_header_sx(ctx, oob=True)),
|
||||
markets_oob_wrap=SxExpr(await oob_header_sx("post-header-child",
|
||||
"markets-header-child", _markets_header_sx(ctx))),
|
||||
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)),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -36,14 +36,13 @@ def _register_events_layouts() -> None:
|
||||
|
||||
async def _cal_admin_full(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)
|
||||
slug = (ctx.get("post") or {}).get("slug", "")
|
||||
return await render_to_sx_with_env("events-cal-admin-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
admin_header=SxExpr(await post_admin_header_sx(ctx, slug, selected="calendars")),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
calendar_admin_header=SxExpr(_calendar_admin_header_sx(ctx)),
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -53,10 +52,10 @@ async def _cal_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
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=SxExpr(await post_admin_header_sx(ctx, slug, oob=True, selected="calendars")),
|
||||
cal_oob=SxExpr(_calendar_header_sx(ctx, oob=True)),
|
||||
cal_admin_oob_wrap=SxExpr(await oob_header_sx("calendar-header-child",
|
||||
"calendar-admin-header-child", _calendar_admin_header_sx(ctx))),
|
||||
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",
|
||||
@@ -76,8 +75,8 @@ async def _slots_oob(ctx: dict, **kw: Any) -> str:
|
||||
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=SxExpr(await post_admin_header_sx(ctx, slug, oob=True, selected="calendars")),
|
||||
cal_admin_oob=SxExpr(_calendar_admin_header_sx(ctx, oob=True)),
|
||||
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",
|
||||
@@ -89,15 +88,14 @@ async def _slots_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _slot_full(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-slot-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
admin_header=SxExpr(await post_admin_header_sx(ctx, slug, selected="calendars")),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
calendar_admin_header=SxExpr(_calendar_admin_header_sx(ctx)),
|
||||
slot_header=SxExpr(_slot_header_html(ctx)),
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -107,10 +105,10 @@ async def _slot_oob(ctx: dict, **kw: Any) -> str:
|
||||
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=SxExpr(await post_admin_header_sx(ctx, slug, oob=True, selected="calendars")),
|
||||
cal_admin_oob=SxExpr(_calendar_admin_header_sx(ctx, oob=True)),
|
||||
slot_oob_wrap=SxExpr(await oob_header_sx("calendar-admin-header-child",
|
||||
"slot-header-child", _slot_header_html(ctx))),
|
||||
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",
|
||||
@@ -123,15 +121,14 @@ async def _slot_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _day_admin_full(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)
|
||||
slug = (ctx.get("post") or {}).get("slug", "")
|
||||
return await render_to_sx_with_env("events-day-admin-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
admin_header=SxExpr(await post_admin_header_sx(ctx, slug, selected="calendars")),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
day_header=SxExpr(_day_header_sx(ctx)),
|
||||
day_admin_header=SxExpr(_day_admin_header_sx(ctx)),
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -141,10 +138,10 @@ async def _day_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
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=SxExpr(await post_admin_header_sx(ctx, slug, oob=True, selected="calendars")),
|
||||
cal_oob=SxExpr(_calendar_header_sx(ctx, oob=True)),
|
||||
day_admin_oob_wrap=SxExpr(await oob_header_sx("day-header-child",
|
||||
"day-admin-header-child", _day_admin_header_sx(ctx))),
|
||||
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",
|
||||
@@ -157,12 +154,11 @@ async def _day_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _entry_full(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import render_to_sx_with_env
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-entry-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
day_header=SxExpr(_day_header_sx(ctx)),
|
||||
entry_header=SxExpr(_entry_header_html(ctx)),
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -170,9 +166,9 @@ 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=SxExpr(_day_header_sx(ctx, oob=True)),
|
||||
entry_oob_wrap=SxExpr(await oob_header_sx("day-header-child",
|
||||
"entry-header-child", _entry_header_html(ctx))),
|
||||
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",
|
||||
@@ -184,16 +180,15 @@ async def _entry_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _entry_admin_full(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)
|
||||
slug = (ctx.get("post") or {}).get("slug", "")
|
||||
return await render_to_sx_with_env("events-entry-admin-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
admin_header=SxExpr(await post_admin_header_sx(ctx, slug, selected="calendars")),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
day_header=SxExpr(_day_header_sx(ctx)),
|
||||
entry_header=SxExpr(_entry_header_html(ctx)),
|
||||
entry_admin_header=SxExpr(_entry_admin_header_html(ctx)),
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
@@ -203,10 +198,10 @@ async def _entry_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
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=SxExpr(await post_admin_header_sx(ctx, slug, oob=True, selected="calendars")),
|
||||
entry_oob=SxExpr(_entry_header_html(ctx, oob=True)),
|
||||
entry_admin_oob_wrap=SxExpr(await oob_header_sx("entry-header-child",
|
||||
"entry-admin-header-child", _entry_admin_header_html(ctx))),
|
||||
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",
|
||||
@@ -220,24 +215,22 @@ async def _entry_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _ticket_types_full(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import render_to_sx_with_env
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-ticket-types-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
day_header=SxExpr(_day_header_sx(ctx)),
|
||||
entry_header=SxExpr(_entry_header_html(ctx)),
|
||||
entry_admin_header=SxExpr(_entry_admin_header_html(ctx)),
|
||||
ticket_types_header=SxExpr(_ticket_types_header_html(ctx)),
|
||||
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
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-ticket-types-layout-oob", {},
|
||||
entry_admin_oob=SxExpr(_entry_admin_header_html(ctx, oob=True)),
|
||||
ticket_types_oob_wrap=SxExpr(await oob_header_sx("entry-admin-header-child",
|
||||
"ticket_types-header-child", _ticket_types_header_html(ctx))),
|
||||
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)),
|
||||
)
|
||||
|
||||
|
||||
@@ -245,25 +238,23 @@ async def _ticket_types_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _ticket_type_full(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import render_to_sx_with_env
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-ticket-type-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
calendar_header=SxExpr(_calendar_header_sx(ctx)),
|
||||
day_header=SxExpr(_day_header_sx(ctx)),
|
||||
entry_header=SxExpr(_entry_header_html(ctx)),
|
||||
entry_admin_header=SxExpr(_entry_admin_header_html(ctx)),
|
||||
ticket_types_header=SxExpr(_ticket_types_header_html(ctx)),
|
||||
ticket_type_header=SxExpr(_ticket_type_header_html(ctx)),
|
||||
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
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-ticket-type-layout-oob", {},
|
||||
ticket_types_oob=SxExpr(_ticket_types_header_html(ctx, oob=True)),
|
||||
ticket_type_oob_wrap=SxExpr(await oob_header_sx("ticket_types-header-child",
|
||||
"ticket_type-header-child", _ticket_type_header_html(ctx))),
|
||||
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)),
|
||||
)
|
||||
|
||||
|
||||
@@ -271,18 +262,16 @@ async def _ticket_type_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
async def _markets_full(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import render_to_sx_with_env
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-markets-layout-full", {},
|
||||
post_header=SxExpr(await _post_header_sx(ctx)),
|
||||
markets_header=SxExpr(_markets_header_sx(ctx)),
|
||||
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
|
||||
from shared.sx.parser import SxExpr
|
||||
return await render_to_sx_with_env("events-markets-layout-oob", {},
|
||||
post_oob=SxExpr(await _post_header_sx(ctx, oob=True)),
|
||||
markets_oob_wrap=SxExpr(await oob_header_sx("post-header-child",
|
||||
"markets-header-child", _markets_header_sx(ctx))),
|
||||
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)),
|
||||
)
|
||||
|
||||
@@ -160,7 +160,7 @@ def _slot_header_html(ctx: dict, *, oob: bool = False) -> str:
|
||||
name=slot.name, description=desc)
|
||||
|
||||
return sx_call("menu-row-sx", id="slot-row", level=5,
|
||||
link_label_content=SxExpr(label_sx),
|
||||
link_label_content=label_sx,
|
||||
child_id="slot-header-child", oob=oob)
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ def render_slot_main_panel(slot, calendar, *, oob: bool = False) -> str:
|
||||
|
||||
result = sx_call("events-slot-panel",
|
||||
slot_id=sid, list_container=list_container,
|
||||
days=SxExpr(days_html),
|
||||
days=days_html,
|
||||
flexible="yes" if flexible else "no",
|
||||
time_str=f"{time_start} \u2014 {time_end}",
|
||||
cost_str=cost_str,
|
||||
@@ -259,7 +259,7 @@ def render_slots_table(slots, calendar) -> str:
|
||||
pill_cls=pill_cls, hx_select=hx_select,
|
||||
slot_name=s.name, description=desc,
|
||||
flexible="yes" if s.flexible else "no",
|
||||
days=SxExpr(days_html),
|
||||
days=days_html,
|
||||
time_str=f"{time_start} - {time_end}",
|
||||
cost_str=cost_str, action_btn=action_btn,
|
||||
del_url=del_url,
|
||||
|
||||
@@ -36,7 +36,7 @@ def _ticket_widget_html(entry, qty: int, ticket_url: str, *, ctx: dict) -> str:
|
||||
return sx_call("events-tw-form",
|
||||
ticket_url=ticket_url, target=tgt,
|
||||
csrf=csrf_token_val, entry_id=str(eid),
|
||||
count_val=str(count_val), btn=SxExpr(btn_html))
|
||||
count_val=str(count_val), btn=btn_html)
|
||||
|
||||
if qty == 0:
|
||||
inner = _tw_form(1, sx_call("events-tw-cart-plus"))
|
||||
@@ -80,7 +80,7 @@ def _tickets_main_panel_html(ctx: dict, tickets: list) -> str:
|
||||
type_name=tt.name if tt else None,
|
||||
time_str=time_str or None,
|
||||
cal_name=cal.name if cal else None,
|
||||
badge=SxExpr(_ticket_state_badge_html(state)),
|
||||
badge=_ticket_state_badge_html(state),
|
||||
code_prefix=ticket.code[:8]))
|
||||
|
||||
cards_html = "".join(ticket_cards)
|
||||
@@ -193,7 +193,7 @@ def _ticket_admin_main_panel_html(ctx: dict, tickets: list, stats: dict) -> str:
|
||||
entry_name=entry.name if entry else "\u2014",
|
||||
date=SxExpr(date_html),
|
||||
type_name=tt.name if tt else "\u2014",
|
||||
badge=SxExpr(_ticket_state_badge_html(state)),
|
||||
badge=_ticket_state_badge_html(state),
|
||||
action=SxExpr(action_html))
|
||||
|
||||
return sx_call("events-ticket-admin-panel",
|
||||
@@ -238,7 +238,7 @@ def render_checkin_result(success: bool, error: str | None, ticket) -> str:
|
||||
entry_name=entry.name if entry else "\u2014",
|
||||
date=SxExpr(date_html),
|
||||
type_name=tt.name if tt else "\u2014",
|
||||
badge=SxExpr(_ticket_state_badge_html("checked_in")),
|
||||
badge=_ticket_state_badge_html("checked_in"),
|
||||
time_str=time_str)
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ def render_lookup_result(ticket, error: str | None) -> str:
|
||||
if cal:
|
||||
info_html += sx_call("events-lookup-cal", cal_name=cal.name)
|
||||
info_html += sx_call("events-lookup-status",
|
||||
badge=SxExpr(_ticket_state_badge_html(state)), code=code)
|
||||
badge=_ticket_state_badge_html(state), code=code)
|
||||
if checked_in_at:
|
||||
info_html += sx_call("events-lookup-checkin-time",
|
||||
date_str=checked_in_at.strftime("%B %d, %Y at %H:%M"))
|
||||
@@ -328,7 +328,7 @@ def render_entry_tickets_admin(entry, tickets: list) -> str:
|
||||
rows_html += sx_call("events-entry-tickets-admin-row",
|
||||
code=code, code_short=code[:12] + "...",
|
||||
type_name=tt.name if tt else "\u2014",
|
||||
badge=SxExpr(_ticket_state_badge_html(state)),
|
||||
badge=_ticket_state_badge_html(state),
|
||||
action=SxExpr(action_html))
|
||||
|
||||
if tickets:
|
||||
@@ -340,7 +340,7 @@ def render_entry_tickets_admin(entry, tickets: list) -> str:
|
||||
return sx_call("events-entry-tickets-admin-panel",
|
||||
entry_name=entry.name,
|
||||
count_label=f"{count} ticket{suffix}",
|
||||
body=SxExpr(body_html))
|
||||
body=body_html)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -519,16 +519,16 @@ def render_buy_form(entry, ticket_remaining, ticket_sold_count,
|
||||
cost_str = f"\u00a3{tt.cost:.2f}" if tt.cost is not None else "\u00a30.00"
|
||||
type_items += sx_call("events-buy-type-item",
|
||||
type_name=tt.name, cost_str=cost_str,
|
||||
adjust_controls=SxExpr(_ticket_adjust_controls(csrf, adjust_url, target, eid, type_count, ticket_type_id=tt.id)))
|
||||
adjust_controls=_ticket_adjust_controls(csrf, adjust_url, target, eid, type_count, ticket_type_id=tt.id))
|
||||
body_html = sx_call("events-buy-types-wrapper", items=SxExpr(type_items))
|
||||
else:
|
||||
qty = user_ticket_count or 0
|
||||
body_html = sx_call("events-buy-default",
|
||||
price_str=f"\u00a3{tp:.2f}",
|
||||
adjust_controls=SxExpr(_ticket_adjust_controls(csrf, adjust_url, target, eid, qty)))
|
||||
adjust_controls=_ticket_adjust_controls(csrf, adjust_url, target, eid, qty))
|
||||
|
||||
return sx_call("events-buy-panel",
|
||||
entry_id=eid_s, info=SxExpr(info_html), body=SxExpr(body_html))
|
||||
entry_id=eid_s, info=SxExpr(info_html), body=body_html)
|
||||
|
||||
|
||||
def _ticket_adjust_controls(csrf, adjust_url, target, entry_id, count, *, ticket_type_id=None):
|
||||
@@ -543,8 +543,8 @@ def _ticket_adjust_controls(csrf, adjust_url, target, entry_id, count, *, ticket
|
||||
return sx_call("events-adjust-form",
|
||||
adjust_url=adjust_url, target=target,
|
||||
extra_cls=extra_cls, csrf=csrf,
|
||||
entry_id=eid_s, tt=SxExpr(tt_html) if tt_html else None,
|
||||
count_val=str(count_val), btn=SxExpr(btn_html))
|
||||
entry_id=eid_s, tt=tt_html or None,
|
||||
count_val=str(count_val), btn=btn_html)
|
||||
|
||||
if count == 0:
|
||||
return _adj_form(1, sx_call("events-adjust-cart-plus"),
|
||||
@@ -557,7 +557,7 @@ def _ticket_adjust_controls(csrf, adjust_url, target, entry_id, count, *, ticket
|
||||
plus = _adj_form(count + 1, sx_call("events-adjust-plus"))
|
||||
|
||||
return sx_call("events-adjust-controls",
|
||||
minus=SxExpr(minus), cart_icon=SxExpr(cart_icon), plus=SxExpr(plus))
|
||||
minus=minus, cart_icon=cart_icon, plus=plus)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -603,7 +603,7 @@ def _ticket_types_header_html(ctx: dict, *, oob: bool = False) -> str:
|
||||
|
||||
return sx_call("menu-row-sx", id="ticket_types-row", level=7,
|
||||
link_href=link_href, link_label_content=SxExpr(label_html),
|
||||
nav=SxExpr(nav_html) if nav_html else None, child_id="ticket_type-header-child", oob=oob)
|
||||
nav=nav_html or None, child_id="ticket_type-header-child", oob=oob)
|
||||
|
||||
|
||||
|
||||
@@ -639,7 +639,7 @@ def _ticket_type_header_html(ctx: dict, *, oob: bool = False) -> str:
|
||||
|
||||
return sx_call("menu-row-sx", id="ticket_type-row", level=8,
|
||||
link_href=link_href, link_label_content=SxExpr(label_html),
|
||||
nav=SxExpr(nav_html) if nav_html else None, child_id="ticket_type-header-child-inner", oob=oob)
|
||||
nav=nav_html or None, child_id="ticket_type-header-child-inner", oob=oob)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from shared.sx.helpers import sx_call
|
||||
from shared.sx.parser import SxExpr
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -146,7 +145,7 @@ def _view_toggle_html(ctx: dict, view: str) -> str:
|
||||
list_href=list_href, tile_href=tile_href,
|
||||
hx_select=hx_select, list_cls=list_active,
|
||||
tile_cls=tile_active, storage_key="events_view",
|
||||
list_svg=SxExpr(_get_list_svg()), tile_svg=SxExpr(_get_tile_svg()))
|
||||
list_svg=_get_list_svg(), tile_svg=_get_tile_svg())
|
||||
|
||||
|
||||
def _cart_icon_oob(count: int) -> str:
|
||||
|
||||
Reference in New Issue
Block a user