Fix market and calendar URL routing
Market: blog links now use market_url('/{slug}/') instead of
events_url('/{slug}/markets/'), matching the market service's
actual route structure /<page_slug>/<market_slug>/.
Calendar: flatten route from /<slug>/calendars/<calendar_slug>/
to /<slug>/<calendar_slug>/ by changing the events app blueprint
prefix and moving listing routes to explicit /calendars/ paths.
Update all hardcoded calendar URL paths across blog and events
services (Python + Jinja templates).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -165,15 +165,18 @@ def _post_admin_nav_html(ctx: dict) -> str:
|
||||
|
||||
parts = []
|
||||
|
||||
# External links to events service
|
||||
# External links to events / market services
|
||||
events_url_fn = ctx.get("events_url")
|
||||
market_url_fn = ctx.get("market_url")
|
||||
if callable(events_url_fn):
|
||||
for path, label in [
|
||||
(f"/{slug}/calendars/", "calendars"),
|
||||
(f"/{slug}/markets/", "markets"),
|
||||
(f"/{slug}/payments/", "payments"),
|
||||
for url_fn, path, label in [
|
||||
(events_url_fn, f"/{slug}/calendar/", "calendar"),
|
||||
(market_url_fn, f"/{slug}/", "markets"),
|
||||
(events_url_fn, f"/{slug}/payments/", "payments"),
|
||||
]:
|
||||
href = events_url_fn(path)
|
||||
if not callable(url_fn):
|
||||
continue
|
||||
href = url_fn(path)
|
||||
parts.append(sexp(
|
||||
'(div :class "relative nav-group" (a :href h :class c l))',
|
||||
h=href, c=nav_btn, l=label,
|
||||
@@ -2573,7 +2576,7 @@ def render_nav_entries_oob(associated_entries, calendars, post: dict, ctx: dict
|
||||
|
||||
if e_start:
|
||||
entry_path = (
|
||||
f"/{post_slug}/calendars/{cal_slug}/"
|
||||
f"/{post_slug}/{cal_slug}/"
|
||||
f"{e_start.year}/{e_start.month}/{e_start.day}"
|
||||
f"/entries/{getattr(entry, 'id', '')}/"
|
||||
)
|
||||
@@ -2581,7 +2584,7 @@ def render_nav_entries_oob(associated_entries, calendars, post: dict, ctx: dict
|
||||
if e_end:
|
||||
date_str += f" \u2013 {e_end.strftime('%H:%M')}"
|
||||
else:
|
||||
entry_path = f"/{post_slug}/calendars/{cal_slug}/"
|
||||
entry_path = f"/{post_slug}/{cal_slug}/"
|
||||
date_str = ""
|
||||
|
||||
href = events_url_fn(entry_path) if events_url_fn else entry_path
|
||||
@@ -2599,7 +2602,7 @@ def render_nav_entries_oob(associated_entries, calendars, post: dict, ctx: dict
|
||||
for calendar in (calendars or []):
|
||||
cal_name = getattr(calendar, "name", "")
|
||||
cal_slug = getattr(calendar, "slug", "")
|
||||
cal_path = f"/{post_slug}/calendars/{cal_slug}/"
|
||||
cal_path = f"/{post_slug}/{cal_slug}/"
|
||||
href = events_url_fn(cal_path) if events_url_fn else cal_path
|
||||
|
||||
item_parts.append(sexp(
|
||||
|
||||
Reference in New Issue
Block a user