add inline block settings editing to page editor
All checks were successful
deploy / deploy (push) Successful in 3m40s
All checks were successful
deploy / deploy (push) Successful in 3m40s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Page builder plan
|
||||
|
||||
Status: In progress (Stage 5 complete)
|
||||
Status: In progress (Stage 7 complete)
|
||||
|
||||
## Context
|
||||
|
||||
@@ -661,44 +661,37 @@ Each stage is a commit point. Tests pass, all pages work, nothing is broken. Pic
|
||||
|
||||
---
|
||||
|
||||
### Stage 6: Admin editor — page list + block management
|
||||
### Stage 6: Admin editor — page list + block management ✅
|
||||
|
||||
**Goal:** admin can see all pages and reorder/add/remove blocks. No inline editing yet. Save persists to DB.
|
||||
**Status:** Complete (commit `660fda9`)
|
||||
|
||||
- [ ] Create `Admin.Pages` LiveView with `:index` and `:edit` live_actions
|
||||
- [ ] Routes: `/admin/pages` and `/admin/pages/:slug`
|
||||
- [ ] Add "Pages" nav link to admin sidebar
|
||||
- [ ] Page list: grouped cards (Marketing, Legal, Shop, Order, System)
|
||||
- [ ] Block list: ordered cards with position number, icon, name
|
||||
- [ ] Move up/down buttons with accessible UX (focus follows, ARIA live region, disabled at edges)
|
||||
- [ ] Remove block button
|
||||
- [ ] "+ Add block" picker showing allowed blocks for this page, with search/filter
|
||||
- [ ] Duplicate block button
|
||||
- [ ] "Reset to defaults" with confirmation
|
||||
- [ ] Save → persist to DB, invalidate cache, flash
|
||||
- [ ] `@dirty` flag + DirtyGuard hook for unsaved changes warning
|
||||
- [ ] Admin CSS for page editor
|
||||
- [ ] Integration tests: list pages, reorder, add, remove, duplicate, reset, save
|
||||
|
||||
**Commit:** `add admin page editor with block reordering and management`
|
||||
|
||||
**Verify:** `mix test` passes, can reorder blocks on home page, save, refresh shop — layout changed
|
||||
- [x] `Admin.Pages.Index` — page list with 5 groups (Marketing, Legal, Shop, Orders, System), icons, block counts
|
||||
- [x] `Admin.Pages.Editor` — block cards with position numbers, icons, names
|
||||
- [x] Routes: `/admin/pages` and `/admin/pages/:slug`, "Pages" nav link in admin sidebar
|
||||
- [x] Move up/down with ARIA live region announcements, disabled at edges
|
||||
- [x] Remove block (with confirmation), duplicate block (copies settings)
|
||||
- [x] "+ Add block" picker with search/filter, enforces `allowed_on` per page
|
||||
- [x] Save → persist to DB, invalidate cache, flash. Reset to defaults with confirmation
|
||||
- [x] `@dirty` flag + DirtyGuard JS hook for unsaved changes warning
|
||||
- [x] Admin CSS for page list, block cards, block picker modal
|
||||
- [x] 25 integration tests covering list, reorder, add, remove, duplicate, reset, save, dirty flag
|
||||
- [x] Regenerated admin icons (81 rules) with `@layer admin` wrapping fix in mix task
|
||||
- [x] Added `:key` to renderer block loop for correct LiveView diffing
|
||||
- [x] 1309 tests pass, `mix precommit` clean
|
||||
|
||||
---
|
||||
|
||||
### Stage 7: Admin editor — inline block editing
|
||||
### Stage 7: Admin editor — inline block editing ✅
|
||||
|
||||
**Goal:** admin can edit block settings (hero text, product count, etc). Full editing workflow complete.
|
||||
**Status:** Complete
|
||||
|
||||
- [ ] Inline settings form generated from `settings_schema`
|
||||
- [ ] Form field types: text, textarea, select, number, json
|
||||
- [ ] Cancel/Apply on each block's settings form
|
||||
- [ ] Block collapse/expand (icon + name one-liner vs expanded card)
|
||||
- [ ] Integration tests: edit hero title, save, verify on shop
|
||||
|
||||
**Commit:** `add inline block settings editing to page editor`
|
||||
|
||||
**Verify:** `mix test` passes, edit home hero title in admin, save, see it on the shop
|
||||
- [x] Inline settings form generated from `settings_schema` — text, textarea, select, number, json (read-only)
|
||||
- [x] Block expand/collapse with `@expanded` MapSet, edit button (cog icon) on blocks with settings
|
||||
- [x] `phx-change` updates working state instantly, no Cancel/Apply (page-level Save/Reset handles it)
|
||||
- [x] Number type coercion (form params → integers), schema defaults merged for missing keys
|
||||
- [x] Full ARIA: `aria-expanded`, `aria-controls`, live region announcements, unique field IDs
|
||||
- [x] Debouncing: 300ms on text/textarea, blur on select/number
|
||||
- [x] 11 new tests (36 total in pages_test), 1320 tests total, `mix precommit` clean
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user