feat: show markets in post nav bar and admin panel
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 38s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 38s
- Post context processor loads MarketPlace rows for the page - Nav bar displays market links (shopping-bag icon) alongside calendars - Admin panel includes markets CRUD when market feature is enabled - Updated shared_lib submodule with nav_entries template change Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ from quart import (
|
|||||||
from .services.post_data import post_data
|
from .services.post_data import post_data
|
||||||
from .services.post_operations import toggle_post_like
|
from .services.post_operations import toggle_post_like
|
||||||
from models.calendars import Calendar
|
from models.calendars import Calendar
|
||||||
|
from models.market_place import MarketPlace
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
|
|
||||||
from suma_browser.app.redis_cacher import cache_page, clear_cache
|
from suma_browser.app.redis_cacher import cache_page, clear_cache
|
||||||
@@ -74,6 +75,14 @@ def register():
|
|||||||
)
|
)
|
||||||
).scalars().all()
|
).scalars().all()
|
||||||
|
|
||||||
|
markets = (
|
||||||
|
await g.s.execute(
|
||||||
|
select(MarketPlace)
|
||||||
|
.where(MarketPlace.post_id == db_post_id, MarketPlace.deleted_at.is_(None))
|
||||||
|
.order_by(MarketPlace.name.asc())
|
||||||
|
)
|
||||||
|
).scalars().all()
|
||||||
|
|
||||||
# Fetch associated entries for nav display
|
# Fetch associated entries for nav display
|
||||||
associated_entries = await get_associated_entries(g.s, db_post_id)
|
associated_entries = await get_associated_entries(g.s, db_post_id)
|
||||||
|
|
||||||
@@ -81,6 +90,7 @@ def register():
|
|||||||
**p_data,
|
**p_data,
|
||||||
"base_title": f"{config()['title']} {p_data['post']['title']}",
|
"base_title": f"{config()['title']} {p_data['post']['title']}",
|
||||||
"calendars": calendars,
|
"calendars": calendars,
|
||||||
|
"markets": markets,
|
||||||
"associated_entries": associated_entries,
|
"associated_entries": associated_entries,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
|
|||||||
Submodule shared_lib updated: 7eb66fbf24...e653acb921
@@ -1,6 +1,6 @@
|
|||||||
{% import 'macros/links.html' as links %}
|
{% import 'macros/links.html' as links %}
|
||||||
{# Associated Entries and Calendars - vertical on mobile, horizontal with arrows on desktop #}
|
{# Associated Entries and Calendars - vertical on mobile, horizontal with arrows on desktop #}
|
||||||
{% if (associated_entries and associated_entries.entries) or calendars %}
|
{% if (associated_entries and associated_entries.entries) or calendars or markets %}
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center gap-2 border-r border-stone-200 mr-2 sm:max-w-2xl"
|
<div class="flex flex-col sm:flex-row sm:items-center gap-2 border-r border-stone-200 mr-2 sm:max-w-2xl"
|
||||||
id="entries-calendars-nav-wrapper">
|
id="entries-calendars-nav-wrapper">
|
||||||
{% include '_types/post/admin/_nav_entries.html' %}
|
{% include '_types/post/admin/_nav_entries.html' %}
|
||||||
|
|||||||
@@ -4,8 +4,12 @@
|
|||||||
class="flex-1 md:h-full md:min-h-0 overflow-y-auto overscroll-contain js-grid-viewport"
|
class="flex-1 md:h-full md:min-h-0 overflow-y-auto overscroll-contain js-grid-viewport"
|
||||||
>
|
>
|
||||||
{% if post and post.is_page %}
|
{% if post and post.is_page %}
|
||||||
<div class="max-w-lg mx-auto mt-6 px-4">
|
<div class="max-w-lg mx-auto mt-6 px-4 space-y-6">
|
||||||
{% include "_types/post/admin/_features_panel.html" %}
|
{% include "_types/post/admin/_features_panel.html" %}
|
||||||
|
|
||||||
|
{% if features.get('market') %}
|
||||||
|
{% include "_types/post/admin/_markets_panel.html" %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="pb-8"></div>
|
<div class="pb-8"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user