add admin page editor with block reordering and management
Stage 6 of the page builder: admin UI at /admin/pages for managing page layouts. Page list shows all 14 pages grouped by category. Editor supports reorder (up/down), add, remove, duplicate, save, and reset to defaults. DirtyGuard JS hook warns on unsaved changes. ARIA live regions announce block operations for screen readers. Also: regenerate admin icons (81 rules via mix task with @layer wrapping), add gen_smtp dep for SMTP email adapter, add :key to page renderer block loop for correct LiveView diffing. 1309 tests, 0 failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -634,10 +634,27 @@ const ChartTooltip = {
|
||||
}
|
||||
}
|
||||
|
||||
// Warns before navigating away from pages with unsaved changes
|
||||
const DirtyGuard = {
|
||||
mounted() {
|
||||
this._beforeUnload = (e) => {
|
||||
if (this.el.dataset.dirty === "true") {
|
||||
e.preventDefault()
|
||||
e.returnValue = ""
|
||||
}
|
||||
}
|
||||
window.addEventListener("beforeunload", this._beforeUnload)
|
||||
},
|
||||
|
||||
destroyed() {
|
||||
window.removeEventListener("beforeunload", this._beforeUnload)
|
||||
}
|
||||
}
|
||||
|
||||
const csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
|
||||
const liveSocket = new LiveSocket("/live", Socket, {
|
||||
params: {_csrf_token: csrfToken, screen_width: window.innerWidth},
|
||||
hooks: {...colocatedHooks, ColorSync, Lightbox, CartPersist, CartDrawer, ProductImageScroll, SearchModal, CollectionFilters, CardRadioScroll, AnalyticsInit, AnalyticsExport, ChartTooltip},
|
||||
hooks: {...colocatedHooks, ColorSync, Lightbox, CartPersist, CartDrawer, ProductImageScroll, SearchModal, CollectionFilters, CardRadioScroll, AnalyticsInit, AnalyticsExport, ChartTooltip, DirtyGuard},
|
||||
})
|
||||
|
||||
// Show progress bar on live navigation and form submits
|
||||
|
||||
Reference in New Issue
Block a user