fix: add post header bar to market pages and show market name
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 36s

- Add post header row to market/index.html template chain
- Fix OOB templates to include post header on HTMX navigation
- Show market name instead of static coop_title in header
- Restore trailing slash on POST /cart/ route; fix templates to
  include trailing slash in cart URLs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-10 23:55:16 +00:00
parent 93e1e6d41e
commit 863429d51b
7 changed files with 22 additions and 20 deletions

View File

@@ -25,7 +25,7 @@ def register(url_prefix, title):
market = getattr(g, "market", None)
market_id = market.id if market else None
return {
"coop_title": title,
"coop_title": market.name if market else title,
"categories": (await get_nav(g.s, market_id=market_id))["cats"],
"qs": makeqs_factory()(),
"market": market,

View File

@@ -157,7 +157,7 @@ def register():
from models.market import CartItem
from quart import request, url_for
@bp.post("/cart")
@bp.post("/cart/")
@clear_cache(tag="browse", tag_scope="user")
async def cart(slug: str):
# make sure product exists (we *allow* deleted_at != None later if you want)

View File

@@ -11,9 +11,9 @@
{% block oobs %}
{% from '_types/root/_n/macros.html' import oob_header with context %}
{{oob_header('root-header-child', 'market-header-child', '_types/market/header/_header.html')}}
{{oob_header('post-header-child', 'market-header-child', '_types/market/header/_header.html')}}
{% from '_types/root/header/_header.html' import header_row with context %}
{% from '_types/post/header/_header.html' import header_row with context %}
{{ header_row(oob=True) }}
{% endblock %}

View File

@@ -11,9 +11,9 @@
{% block oobs %}
{% from '_types/root/_n/macros.html' import oob_header with context %}
{{oob_header('root-header-child', 'market-header-child', '_types/market/header/_header.html')}}
{{oob_header('post-header-child', 'market-header-child', '_types/market/header/_header.html')}}
{% from '_types/root/header/_header.html' import header_row with context %}
{% from '_types/post/header/_header.html' import header_row with context %}
{{ header_row(oob=True) }}
{% endblock %}

View File

@@ -3,10 +3,12 @@
{% block root_header_child %}
{% from '_types/root/_n/macros.html' import index_row with context %}
{% call index_row('post-header-child', '_types/post/header/_header.html') %}
{% call index_row('market-header-child', '_types/market/header/_header.html') %}
{% block market_header_child %}
{% endblock %}
{% endcall %}
{% endcall %}
{% endblock %}

View File

@@ -7,9 +7,9 @@
{% if not quantity %}
<form
action="{{ market_url('/product/' + slug + '/cart') }}"
action="{{ market_url('/product/' + slug + '/cart/') }}"
method="post"
hx-post="{{ market_url('/product/' + slug + '/cart') }}"
hx-post="{{ market_url('/product/' + slug + '/cart/') }}"
hx-target="#cart-mini"
hx-swap="outerHTML"
class="rounded flex items-center"
@@ -38,9 +38,9 @@
<div class="rounded flex items-center gap-2">
<!-- minus -->
<form
action="{{ market_url('/product/' + slug + '/cart') }}"
action="{{ market_url('/product/' + slug + '/cart/') }}"
method="post"
hx-post="{{ market_url('/product/' + slug + '/cart') }}"
hx-post="{{ market_url('/product/' + slug + '/cart/') }}"
hx-target="#cart-mini"
hx-swap="outerHTML"
>
@@ -80,9 +80,9 @@
<!-- plus -->
<form
action="{{ market_url('/product/' + slug + '/cart') }}"
action="{{ market_url('/product/' + slug + '/cart/') }}"
method="post"
hx-post="{{ market_url('/product/' + slug + '/cart') }}"
hx-post="{{ market_url('/product/' + slug + '/cart/') }}"
hx-target="#cart-mini"
hx-swap="outerHTML"
>
@@ -189,9 +189,9 @@
<div class="flex items-center gap-2 text-xs sm:text-sm text-stone-700">
<span class="text-[0.65rem] sm:text-xs uppercase tracking-wide text-stone-500">Quantity</span>
<form
action="{{ market_url('/product/' + p.slug + '/cart') }}"
action="{{ market_url('/product/' + p.slug + '/cart/') }}"
method="post"
hx-post="{{ market_url('/product/' + p.slug + '/cart') }}"
hx-post="{{ market_url('/product/' + p.slug + '/cart/') }}"
hx-target="#cart-mini"
hx-swap="outerHTML"
>
@@ -212,9 +212,9 @@
{{ item.quantity }}
</span>
<form
action="{{ market_url('/product/' + p.slug + '/cart') }}"
action="{{ market_url('/product/' + p.slug + '/cart/') }}"
method="post"
hx-post="{{ market_url('/product/' + p.slug + '/cart') }}"
hx-post="{{ market_url('/product/' + p.slug + '/cart/') }}"
hx-target="#cart-mini"
hx-swap="outerHTML"
>