Compare commits
7 Commits
9c047b46b5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5053448ee2 | ||
|
|
7b384bd335 | ||
|
|
8fad1ecc7d | ||
|
|
af260872d1 | ||
|
|
f90d0f2e21 | ||
|
|
218849552d | ||
|
|
6bb520cb0a |
@@ -7,7 +7,8 @@ on:
|
||||
env:
|
||||
REGISTRY: registry.rose-ash.com:5000
|
||||
IMAGE: blog
|
||||
REPO_DIR: /root/blog
|
||||
REPO_DIR: /root/rose-ash/blog
|
||||
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...'
|
||||
|
||||
14
Dockerfile
14
Dockerfile
@@ -1,5 +1,14 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# ---------- Stage 1: Build editor JS/CSS ----------
|
||||
FROM node:20-slim AS editor-build
|
||||
WORKDIR /build
|
||||
COPY shared_lib/editor/package.json shared_lib/editor/package-lock.json* ./
|
||||
RUN npm ci --ignore-scripts 2>/dev/null || npm install
|
||||
COPY shared_lib/editor/ ./
|
||||
RUN NODE_ENV=production node build.mjs
|
||||
|
||||
# ---------- Stage 2: Python runtime ----------
|
||||
FROM python:3.11-slim AS base
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
@@ -21,8 +30,11 @@ RUN pip install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
# Copy built editor assets from stage 1
|
||||
COPY --from=editor-build /static/scripts/editor.js /static/scripts/editor.css shared_lib/static/scripts/
|
||||
|
||||
# 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
|
||||
|
||||
@@ -74,12 +74,14 @@ def register():
|
||||
|
||||
post_id = post["id"]
|
||||
|
||||
# Load PageConfig
|
||||
# Load or create PageConfig
|
||||
pc = (await g.s.execute(
|
||||
sa_select(PageConfig).where(PageConfig.post_id == post_id)
|
||||
)).scalar_one_or_none()
|
||||
if pc is None:
|
||||
return jsonify({"error": "PageConfig not found for this page."}), 404
|
||||
pc = PageConfig(post_id=post_id, features={})
|
||||
g.s.add(pc)
|
||||
await g.s.flush()
|
||||
|
||||
# Parse request body
|
||||
body = await request.get_json()
|
||||
@@ -139,7 +141,9 @@ def register():
|
||||
sa_select(PageConfig).where(PageConfig.post_id == post_id)
|
||||
)).scalar_one_or_none()
|
||||
if pc is None:
|
||||
return jsonify({"error": "PageConfig not found for this page."}), 404
|
||||
pc = PageConfig(post_id=post_id, features={})
|
||||
g.s.add(pc)
|
||||
await g.s.flush()
|
||||
|
||||
form = await request.form
|
||||
merchant_code = (form.get("merchant_code") or "").strip()
|
||||
|
||||
@@ -65,6 +65,7 @@ def register():
|
||||
p_data = getattr(g, "post_data", None)
|
||||
if p_data:
|
||||
from .services.entry_associations import get_associated_entries
|
||||
from shared.internal_api import get as api_get
|
||||
|
||||
db_post_id = (g.post_data.get("post") or {}).get("id") # <-- integer
|
||||
calendars = (
|
||||
@@ -86,13 +87,30 @@ def register():
|
||||
# Fetch associated entries for nav display
|
||||
associated_entries = await get_associated_entries(g.s, db_post_id)
|
||||
|
||||
return {
|
||||
ctx = {
|
||||
**p_data,
|
||||
"base_title": f"{config()['title']} {p_data['post']['title']}",
|
||||
"calendars": calendars,
|
||||
"markets": markets,
|
||||
"associated_entries": associated_entries,
|
||||
}
|
||||
|
||||
# Page cart badge: fetch page-scoped cart count for pages
|
||||
post_dict = p_data.get("post") or {}
|
||||
if post_dict.get("is_page"):
|
||||
page_cart = await api_get(
|
||||
"cart",
|
||||
f"/internal/cart/summary?page_slug={post_dict['slug']}",
|
||||
forward_session=True,
|
||||
)
|
||||
if page_cart:
|
||||
ctx["page_cart_count"] = page_cart.get("count", 0) + page_cart.get("calendar_count", 0)
|
||||
ctx["page_cart_total"] = page_cart.get("total", 0) + page_cart.get("calendar_total", 0)
|
||||
else:
|
||||
ctx["page_cart_count"] = 0
|
||||
ctx["page_cart_total"] = 0
|
||||
|
||||
return ctx
|
||||
else:
|
||||
return {}
|
||||
|
||||
|
||||
Submodule shared_lib updated: 123f752946...0c9b8d6aa2
@@ -3,14 +3,5 @@
|
||||
id="main-panel"
|
||||
class="flex-1 md:h-full md:min-h-0 overflow-y-auto overscroll-contain js-grid-viewport"
|
||||
>
|
||||
{% if post and post.is_page %}
|
||||
<div class="max-w-lg mx-auto mt-6 px-4 space-y-6">
|
||||
{% include "_types/post/admin/_features_panel.html" %}
|
||||
|
||||
{% if features.get('market') %}
|
||||
{% include "_types/post/admin/_markets_panel.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="pb-8"></div>
|
||||
</section>
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
calendars
|
||||
</a>
|
||||
</div>
|
||||
<div class="relative nav-group">
|
||||
<a href="{{ events_url('/' + post.slug + '/markets/') }}" class="{{styles.nav_button}}">
|
||||
markets
|
||||
</a>
|
||||
</div>
|
||||
<div class="relative nav-group">
|
||||
<a href="{{ events_url('/' + post.slug + '/payments/') }}" class="{{styles.nav_button}}">
|
||||
payments
|
||||
</a>
|
||||
</div>
|
||||
{% call links.link(url_for('blog.post.admin.entries', slug=post.slug), hx_select_search, select_colours, True, aclass=styles.nav_button) %}
|
||||
entries
|
||||
{% endcall %}
|
||||
|
||||
@@ -18,5 +18,5 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
nowt
|
||||
{% include '_types/post/admin/_main_panel.html' %}
|
||||
{% endblock %}
|
||||
@@ -14,5 +14,5 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
nowt
|
||||
{% include '_types/post/admin/_main_panel.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -12,7 +12,16 @@
|
||||
{{ post.title | truncate(160, True, '…') }}
|
||||
</span>
|
||||
{% endcall %}
|
||||
{% call links.desktop_nav() %}
|
||||
{% call links.desktop_nav() %}
|
||||
{% if page_cart_count is defined and page_cart_count > 0 %}
|
||||
<a
|
||||
href="{{ cart_url('/' + post.slug + '/') }}"
|
||||
class="relative inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-full border border-emerald-300 bg-emerald-50 text-emerald-800 hover:bg-emerald-100 transition"
|
||||
>
|
||||
<i class="fa fa-shopping-cart" aria-hidden="true"></i>
|
||||
<span>{{ page_cart_count }}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% include '_types/post/_nav.html' %}
|
||||
{% endcall %}
|
||||
{% endcall %}
|
||||
|
||||
Reference in New Issue
Block a user