From 69b97d51fe37296f482d897abcc261b8aecf7691 Mon Sep 17 00:00:00 2001 From: NguyenND Date: Wed, 22 Jul 2026 17:13:26 -0400 Subject: [PATCH] Jul 22 - Update - add Rich-text editor, draft/publish, drag-to-reorder --- CLAUDE.md | 36 +- README.md | 25 +- add_publish.sql | 20 + admin.py | 67 ++- app.py | 35 +- requirements.txt | 1 + schema.sql | 1 + static/css/admin.css | 43 ++ static/vendor/Sortable.min.js | 2 + static/vendor/quill.min.js | 8 + static/vendor/quill.snow.css | 945 ++++++++++++++++++++++++++++++++ templates/admin/base.html | 3 + templates/admin/dashboard.html | 69 ++- templates/admin/topic_form.html | 61 ++- templates/index.html | 2 +- 15 files changed, 1295 insertions(+), 23 deletions(-) create mode 100644 add_publish.sql create mode 100644 static/vendor/Sortable.min.js create mode 100644 static/vendor/quill.min.js create mode 100644 static/vendor/quill.snow.css diff --git a/CLAUDE.md b/CLAUDE.md index 7fada69..be7fb0b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -40,10 +40,11 @@ Ubuntu 24.04. Fonts via Google Fonts (Bricolage Grotesque, IBM Plex Sans/Mono). - `section(id, num UNIQUE, title, subtitle, sort_order)` - `topic(id, section_id FK cascade, slug UNIQUE, title, body_html, link_url, link_label, media_type[none|image|video|embed], media_url, media_caption, - sort_order)` + sort_order, is_published)` - `audit_log(id, actor, action, entity, entity_id, detail, created_at)` -Public page orders sections by `sort_order, num`; topics by `sort_order`. +Public page orders sections by `sort_order, num`; topics by `sort_order`, and +shows only `is_published` topics (sections with no published topics are hidden). ## Conventions (follow every change) @@ -103,12 +104,41 @@ Public page orders sections by `sort_order, num`; topics by `sort_order`. - CSRF-less POST floods get HTTP 400 before the view, so they don't reach the auth log — add nginx `limit_req` on `/admin/login` if that traffic matters. +## Content editing (rich text / publish / reorder) + +- **Rich text:** Quill 1.3.7 vendored at `static/vendor/` (no CDN — survives a + locked-down server or strict CSP). It's a *progressive enhancement over a real + ` +
+ Body +
+ + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + {% set pub = (form.get('is_published') == '1') if form is not none else (topic.is_published if topic else True) %} +
@@ -99,3 +133,24 @@ {% endblock %} + +{% block scripts %} + + +{% endblock %} diff --git a/templates/index.html b/templates/index.html index 04ed23f..d7ea631 100644 --- a/templates/index.html +++ b/templates/index.html @@ -45,7 +45,7 @@