Enable cross-subdomain htmx and purify layout to sexp
- Disable htmx selfRequestsOnly, add CORS headers for *.rose-ash.com - Remove same-origin guards from ~menu-row and ~nav-link htmx attrs - Convert ~app-layout from string-concatenated HTML to pure sexp tree - Extract ~app-head component, replace ~app-shell with inline structure - Convert hamburger SVG from Python HTML constant to ~hamburger sexp component - Fix cross-domain fragment URLs (events_url, market_url) - Fix starts-with? primitive to handle nil values - Fix duplicate admin menu rows on OOB swaps - Add calendar admin nav links (slots, description) - Convert slots page from Jinja to sexp rendering - Disable page caching in development mode - Backfill migration to clean orphaned container_relations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -86,19 +86,21 @@ def _post_header_html(ctx: dict, *, oob: bool = False) -> str:
|
||||
)
|
||||
|
||||
# Admin link
|
||||
from quart import url_for as qurl, g
|
||||
from quart import url_for as qurl, g, request
|
||||
rights = ctx.get("rights") or {}
|
||||
has_admin = rights.get("admin") if isinstance(rights, dict) else getattr(rights, "admin", False)
|
||||
if has_admin:
|
||||
hx_select = ctx.get("hx_select_search", "#main-panel")
|
||||
select_colours = ctx.get("select_colours", "")
|
||||
styles = ctx.get("styles") or {}
|
||||
nav_btn = styles.get("nav_button", "") if isinstance(styles, dict) else getattr(styles, "nav_button", "")
|
||||
admin_href = qurl("blog.post.admin.admin", slug=slug)
|
||||
is_admin_page = "/admin" in request.path
|
||||
sel_attr = ' aria-selected="true"' if is_admin_page else ''
|
||||
nav_parts.append(
|
||||
f'<div class="relative nav-group"><a href="{admin_href}"'
|
||||
f' hx-get="{admin_href}" hx-target="#main-panel" hx-select="{hx_select}"'
|
||||
f' hx-get="{admin_href}" hx-target="#main-panel" hx-select="#main-panel"'
|
||||
f' hx-swap="outerHTML" hx-push-url="true"'
|
||||
f'{sel_attr}'
|
||||
f' class="{nav_btn} {select_colours}">'
|
||||
f'<i class="fa fa-cog" aria-hidden="true"></i></a></div>'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user