Compare commits
11 Commits
6459e2406e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41b4e0fe24 | ||
|
|
b8f57ef92f | ||
|
|
20fde958ec | ||
|
|
9ee0c91106 | ||
|
|
fd205b9b61 | ||
|
|
2788e24ec8 | ||
|
|
863429d51b | ||
|
|
93e1e6d41e | ||
|
|
7065acb94d | ||
|
|
9fb26129b6 | ||
|
|
6a378a2425 |
@@ -7,7 +7,8 @@ on:
|
||||
env:
|
||||
REGISTRY: registry.rose-ash.com:5000
|
||||
IMAGE: market
|
||||
REPO_DIR: /root/market
|
||||
REPO_DIR: /root/rose-ash/market
|
||||
COOP_DIR: /root/coop
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
@@ -58,7 +59,7 @@ jobs:
|
||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||
run: |
|
||||
ssh "root@$DEPLOY_HOST" "
|
||||
cd /root/coop
|
||||
cd ${{ env.COOP_DIR }}
|
||||
source .env
|
||||
docker stack deploy -c docker-compose.yml coop
|
||||
echo 'Waiting for services to update...'
|
||||
|
||||
@@ -23,7 +23,7 @@ RUN pip install -r requirements.txt
|
||||
COPY . .
|
||||
|
||||
# Link app blueprints into the shared library's namespace
|
||||
RUN ln -s /app/bp /app/shared_lib/suma_browser/app/bp
|
||||
RUN rm -rf /app/shared_lib/suma_browser/app/bp && ln -s /app/bp /app/shared_lib/suma_browser/app/bp
|
||||
|
||||
# ---------- Runtime setup ----------
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
|
||||
10
app.py
10
app.py
@@ -8,6 +8,7 @@ from jinja2 import FileSystemLoader, ChoiceLoader
|
||||
from sqlalchemy import select
|
||||
|
||||
from shared.factory import create_base_app
|
||||
from shared.cart_loader import load_cart
|
||||
from config import config
|
||||
|
||||
from suma_browser.app.bp import register_market_bp
|
||||
@@ -45,7 +46,7 @@ def create_app() -> "Quart":
|
||||
from models.market_place import MarketPlace
|
||||
from models.ghost_content import Post
|
||||
|
||||
app = create_base_app("market", context_fn=market_context)
|
||||
app = create_base_app("market", context_fn=market_context, before_request_fns=[load_cart])
|
||||
|
||||
# App-specific templates override shared templates
|
||||
app_templates = str(Path(__file__).resolve().parent / "templates")
|
||||
@@ -124,6 +125,13 @@ def create_app() -> "Quart":
|
||||
abort(404)
|
||||
g.market = market
|
||||
|
||||
@app.context_processor
|
||||
async def inject_post():
|
||||
post_data = getattr(g, "post_data", None)
|
||||
if not post_data:
|
||||
return {}
|
||||
return {**post_data}
|
||||
|
||||
# --- Root route: market listing ---
|
||||
@app.get("/")
|
||||
async def markets_listing():
|
||||
|
||||
@@ -24,8 +24,10 @@ def register(url_prefix, title):
|
||||
async def inject_root():
|
||||
market = getattr(g, "market", None)
|
||||
market_id = market.id if market else None
|
||||
post_data = getattr(g, "post_data", None) or {}
|
||||
return {
|
||||
"coop_title": title,
|
||||
**post_data,
|
||||
"coop_title": market.name if market else title,
|
||||
"categories": (await get_nav(g.s, market_id=market_id))["cats"],
|
||||
"qs": makeqs_factory()(),
|
||||
"market": market,
|
||||
|
||||
@@ -242,7 +242,8 @@ def register():
|
||||
)
|
||||
|
||||
# normal POST: go to cart page
|
||||
return redirect(url_for("cart.view_cart"))
|
||||
from shared.urls import cart_url
|
||||
return redirect(cart_url("/"))
|
||||
|
||||
|
||||
|
||||
|
||||
Submodule shared_lib updated: 123f752946...356d916e26
@@ -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 %}
|
||||
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
|
||||
{% block root_header_child %}
|
||||
{% from '_types/root/_n/macros.html' import index_row with context %}
|
||||
{% call index_row('market-header-child', '_types/market/header/_header.html') %}
|
||||
{% block market_header_child %}
|
||||
{% endblock %}
|
||||
{% 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 %}
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
{% if not quantity %}
|
||||
<form
|
||||
action="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
action="{{ url_for('market.browse.product.cart', slug=slug) }}"
|
||||
method="post"
|
||||
hx-post="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
hx-post="{{ url_for('market.browse.product.cart', slug=slug) }}"
|
||||
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="{{ url_for('market.browse.product.cart', slug=slug) }}"
|
||||
method="post"
|
||||
hx-post="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
hx-post="{{ url_for('market.browse.product.cart', slug=slug) }}"
|
||||
hx-target="#cart-mini"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
@@ -80,9 +80,9 @@
|
||||
|
||||
<!-- plus -->
|
||||
<form
|
||||
action="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
action="{{ url_for('market.browse.product.cart', slug=slug) }}"
|
||||
method="post"
|
||||
hx-post="{{ market_url('/product/' + slug + '/cart') }}"
|
||||
hx-post="{{ url_for('market.browse.product.cart', slug=slug) }}"
|
||||
hx-target="#cart-mini"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
@@ -139,7 +139,7 @@
|
||||
<div class="flex flex-col sm:flex-row sm:items-start justify-between gap-2 sm:gap-3">
|
||||
<div class="min-w-0">
|
||||
<h2 class="text-sm sm:text-base md:text-lg font-semibold text-stone-900">
|
||||
{% set href=market_url('/product/' + p.slug + '/') %}
|
||||
{% set href=url_for('market.browse.product.product_detail', slug=p.slug) %}
|
||||
<a
|
||||
href="{{ href }}"
|
||||
hx_get="{{href}}"
|
||||
@@ -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="{{ url_for('market.browse.product.cart', slug=p.slug) }}"
|
||||
method="post"
|
||||
hx-post="{{ market_url('/product/' + p.slug + '/cart') }}"
|
||||
hx-post="{{ url_for('market.browse.product.cart', slug=p.slug) }}"
|
||||
hx-target="#cart-mini"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
@@ -212,9 +212,9 @@
|
||||
{{ item.quantity }}
|
||||
</span>
|
||||
<form
|
||||
action="{{ market_url('/product/' + p.slug + '/cart') }}"
|
||||
action="{{ url_for('market.browse.product.cart', slug=p.slug) }}"
|
||||
method="post"
|
||||
hx-post="{{ market_url('/product/' + p.slug + '/cart') }}"
|
||||
hx-post="{{ url_for('market.browse.product.cart', slug=p.slug) }}"
|
||||
hx-target="#cart-mini"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user