feat(pages): drafts for published pages, starter templates and duplicate #62

Merged
ngqile merged 8 commits from add-page-drafts-and-templates into main 2026-12-03 04:07:24 +00:00
Owner

OpenSpec change add-page-drafts-and-templates (page builder, change 2 of 3).

What

  • Draft and live split. When staff save a published page, the changes go to a new cms_page.draft JSON column, and visitors keep seeing the live version. The editor then shows a banner with Publish changes and Discard changes; Discard asks first. After a save, the banner scrolls into view.
    • Publish checks the draft again: the blocks, and that the slug is still free.
    • Saving a page with status Draft takes it offline and drops the draft.
  • Preview shows the draft, including Custom HTML frames. The pages list marks such pages "Unpublished changes".
  • Starter templates. New page first offers Blank, Event sign-up or Service showcase. A template fills the editor with placeholder sections and a sign-up form named signup with no event set.
  • Duplicate, on the list and in the editor, opens /pages/new?from=<id>. The copy is a new draft of the same company, titled "
OpenSpec change `add-page-drafts-and-templates` (page builder, change 2 of 3). ## What - **Draft and live split.** When staff save a published page, the changes go to a new `cms_page.draft` JSON column, and visitors keep seeing the live version. The editor then shows a banner with **Publish changes** and **Discard changes**; Discard asks first. After a save, the banner scrolls into view. - Publish checks the draft again: the blocks, and that the slug is still free. - Saving a page with status Draft takes it offline and drops the draft. - **Preview** shows the draft, including Custom HTML frames. The pages list marks such pages "Unpublished changes". - **Starter templates.** New page first offers Blank, Event sign-up or Service showcase. A template fills the editor with placeholder sections and a sign-up form named `signup` with no event set. - **Duplicate**, on the list and in the editor, opens `/pages/new?from=<id>`. The copy is a new draft of the same company, titled "<title> (copy)" with slug "<slug>-copy". Nothing is stored until Save. - **APIs.** services-counter adds `/counter/cmsPage/publish` and `/counter/cmsPage/discard`. mobile-api adds `POST /api/admin/pages/{id}/publish` and `/discard`, scoped to the caller's company. - **Labels:** 18 new, in English and zh_CN. ## SQL 1. `sql/01-page-draft.sql`: run before the new services-counter starts. 2. `sql/02-draft-template-labels.sql`: run after deploy. 3. Rollback: `sql/99-rollback.sql`. It drops every unpublished draft. See `docs/deployment.md` §12. ## Verification - `mvn -T 1C -pl solvway-services-counter -am verify`: 377 tests pass. - `mvn -T 1C -pl solvway-mobile-api -am verify`: 997 tests pass. - Portal: vitest 1924 pass, `tsc` clean, lint has the 4 old warnings only. - `openspec validate --strict`: valid. - Live Playwright check on disposable pages, deleted afterwards, at 1280 and 360 px: - Both templates were refused without an event, then saved. - Edited a published page: the visitor still saw the old version while Preview showed the draft. The list showed "Unpublished changes". - Publish changes made the edit live. Discard asked first, then restored the live content. - Duplicate saved a new draft copy. - A slug clash was refused at the Slug field and the banner stayed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
ngqile added 8 commits 2026-12-03 04:07:20 +00:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
ngqile merged commit 3b977fc277 into main 2026-12-03 04:07:24 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ngqile/co-lite#62