Phase 1-3 of decoupling: - path_setup.py adds project root to sys.path - Cart-owned models in cart/models/ (order, page_config) - All imports updated: shared.infrastructure, shared.db, shared.browser, etc. - PageConfig uses container_type/container_id instead of post_id FK Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
925 B
Python
32 lines
925 B
Python
# bp/cart/overview_routes.py — Cart overview (list of page carts)
|
|
|
|
from __future__ import annotations
|
|
|
|
from quart import Blueprint, render_template, make_response
|
|
|
|
from shared.browser.app.utils.htmx import is_htmx_request
|
|
from .services import get_cart_grouped_by_page
|
|
|
|
|
|
def register(url_prefix: str) -> Blueprint:
|
|
bp = Blueprint("cart_overview", __name__, url_prefix=url_prefix)
|
|
|
|
@bp.get("/")
|
|
async def overview():
|
|
from quart import g
|
|
page_groups = await get_cart_grouped_by_page(g.s)
|
|
|
|
if not is_htmx_request():
|
|
html = await render_template(
|
|
"_types/cart/overview/index.html",
|
|
page_groups=page_groups,
|
|
)
|
|
else:
|
|
html = await render_template(
|
|
"_types/cart/overview/_oob_elements.html",
|
|
page_groups=page_groups,
|
|
)
|
|
return await make_response(html)
|
|
|
|
return bp
|