This repository has been archived on 2026-02-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
market/bp/market/routes.py
giles 863429d51b
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 36s
fix: add post header bar to market pages and show market name
- 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>
2026-02-10 23:55:16 +00:00

48 lines
1017 B
Python

from __future__ import annotations
from quart import Blueprint, g, render_template, make_response, url_for
from ..browse.routes import register as register_browse_bp
from .filters.qs import makeqs_factory
from ..browse.services.nav import get_nav
from ..api.routes import products_api
from .admin.routes import register as register_admin
def register(url_prefix, title):
bp = Blueprint("market", __name__, url_prefix)
@bp.before_request
def route():
g.makeqs_factory = makeqs_factory
@bp.context_processor
async def inject_root():
market = getattr(g, "market", None)
market_id = market.id if market else None
return {
"coop_title": market.name if market else title,
"categories": (await get_nav(g.s, market_id=market_id))["cats"],
"qs": makeqs_factory()(),
"market": market,
}
bp.register_blueprint(
register_browse_bp(),
)
bp.register_blueprint(
products_api,
)
bp.register_blueprint(
register_admin(),
)
return bp