add admin CRUD for custom CMS pages
All checks were successful
deploy / deploy (push) Successful in 1m21s
All checks were successful
deploy / deploy (push) Successful in 1m21s
New settings form for creating and editing custom page metadata (title, slug, meta description, published, nav settings). Pages index shows custom pages section with draft badges and delete. Editor shows settings button for custom pages, hides reset to defaults. 20 new tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@ defmodule BerrypodWeb.Admin.Pages.Editor do
|
||||
use BerrypodWeb, :live_view
|
||||
|
||||
alias Berrypod.{Media, Pages}
|
||||
alias Berrypod.Pages.{BlockEditor, BlockTypes}
|
||||
alias Berrypod.Pages.{BlockEditor, BlockTypes, Page}
|
||||
alias Berrypod.Products.ProductImage
|
||||
alias Berrypod.Theme.{Fonts, PreviewData}
|
||||
|
||||
@@ -38,7 +38,8 @@ defmodule BerrypodWeb.Admin.Pages.Editor do
|
||||
|> assign(:image_picker_block_id, nil)
|
||||
|> assign(:image_picker_field_key, nil)
|
||||
|> assign(:image_picker_images, [])
|
||||
|> assign(:image_picker_search, "")}
|
||||
|> assign(:image_picker_search, "")
|
||||
|> assign(:is_custom_page, !Page.system_slug?(slug))}
|
||||
end
|
||||
|
||||
# ── Block manipulation events ────────────────────────────────────
|
||||
@@ -310,7 +311,15 @@ defmodule BerrypodWeb.Admin.Pages.Editor do
|
||||
/>
|
||||
{if @show_preview, do: "Edit", else: "Preview"}
|
||||
</button>
|
||||
<.link
|
||||
:if={@is_custom_page}
|
||||
navigate={~p"/admin/pages/#{@slug}/settings"}
|
||||
class="admin-btn admin-btn-sm admin-btn-ghost"
|
||||
>
|
||||
<.icon name="hero-cog-6-tooth" class="size-4" /> Settings
|
||||
</.link>
|
||||
<button
|
||||
:if={!@is_custom_page}
|
||||
phx-click="reset_defaults"
|
||||
data-confirm="Reset this page to its default layout? Your changes will be lost."
|
||||
class="admin-btn admin-btn-sm admin-btn-ghost"
|
||||
|
||||
Reference in New Issue
Block a user