fix page settings section and blocks not showing in editor
All checks were successful
deploy / deploy (push) Successful in 1m16s
All checks were successful
deploy / deploy (push) Successful in 1m16s
Two bugs fixed: 1. Page Settings section wasn't appearing for system pages because Defaults.for_slug didn't return all required fields (type, meta_description, published, etc). Also changed page_renderer to use bracket notation for safer field access. 2. Blocks weren't loading when navigating directly to ?edit=page because the PageEditorHook's handle_params ran before Shop.Page assigned @page. Added pending page mode mechanism: hook sets a flag when edit mode is requested but @page is nil, then Shop.Page calls maybe_enter_pending_page_mode after @page is assigned. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -374,18 +374,20 @@ defmodule BerrypodWeb.PageRenderer do
|
||||
form = assigns.form || %{}
|
||||
is_custom = assigns.page[:type] == "custom"
|
||||
|
||||
page = assigns.page
|
||||
|
||||
assigns =
|
||||
assigns
|
||||
|> assign(:is_custom, is_custom)
|
||||
|> assign(:form_title, form["title"] || assigns.page.title || "")
|
||||
|> assign(:form_slug, form["slug"] || assigns.page.slug || "")
|
||||
|> assign(:form_meta, form["meta_description"] || assigns.page.meta_description || "")
|
||||
|> assign(:form_published, form_checked?(form, "published", assigns.page.published))
|
||||
|> assign(:form_show_in_nav, form_checked?(form, "show_in_nav", assigns.page.show_in_nav))
|
||||
|> assign(:form_nav_label, form["nav_label"] || assigns.page.nav_label || "")
|
||||
|> assign(:form_title, form["title"] || page[:title] || "")
|
||||
|> assign(:form_slug, form["slug"] || page[:slug] || "")
|
||||
|> assign(:form_meta, form["meta_description"] || page[:meta_description] || "")
|
||||
|> assign(:form_published, form_checked?(form, "published", page[:published]))
|
||||
|> assign(:form_show_in_nav, form_checked?(form, "show_in_nav", page[:show_in_nav]))
|
||||
|> assign(:form_nav_label, form["nav_label"] || page[:nav_label] || "")
|
||||
|> assign(
|
||||
:form_nav_position,
|
||||
form["nav_position"] || to_string(assigns.page.nav_position || 0)
|
||||
form["nav_position"] || to_string(page[:nav_position] || 0)
|
||||
)
|
||||
|
||||
~H"""
|
||||
|
||||
Reference in New Issue
Block a user