complete editor panel reorganisation polish
All checks were successful
deploy / deploy (push) Successful in 6m49s
All checks were successful
deploy / deploy (push) Successful in 6m49s
- fix Site tab not loading theme state on direct URL navigation - fix nav editor showing "Custom URL" for page links (detect by URL match) - add Home option to nav page picker - mark editor-reorganisation plan as complete - add dynamic-url-customisation and draft-publish-workflow plans Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -622,6 +622,17 @@ defmodule BerrypodWeb.ShopComponents.SiteEditor do
|
||||
attr :event_prefix, :string, default: "site_"
|
||||
|
||||
defp nav_editor(assigns) do
|
||||
# Build a set of known page URLs for quick lookup
|
||||
page_urls =
|
||||
Enum.flat_map(assigns.pages, fn page ->
|
||||
[page.slug, "/#{page.slug}"]
|
||||
end)
|
||||
|> MapSet.new()
|
||||
|> MapSet.put("/collections/all")
|
||||
|> MapSet.put("/")
|
||||
|
||||
assigns = assign(assigns, :page_urls, page_urls)
|
||||
|
||||
~H"""
|
||||
<div class="site-editor-nav-list">
|
||||
<ul :if={@items != []} class="site-editor-nav-items">
|
||||
@@ -630,6 +641,10 @@ defmodule BerrypodWeb.ShopComponents.SiteEditor do
|
||||
class="site-editor-nav-item"
|
||||
data-item-id={item.id}
|
||||
>
|
||||
<%
|
||||
# Determine if this item links to a known page (by URL match or page_id)
|
||||
is_page_link = item.page_id != nil or MapSet.member?(@page_urls, item.url)
|
||||
%>
|
||||
<form
|
||||
class="site-editor-nav-item-form"
|
||||
phx-change={@event_prefix <> "update_nav_item"}
|
||||
@@ -651,10 +666,10 @@ defmodule BerrypodWeb.ShopComponents.SiteEditor do
|
||||
class="admin-select admin-select-sm site-editor-nav-type"
|
||||
aria-label="Link type"
|
||||
>
|
||||
<option value="page" selected={item.page_id != nil}>Page</option>
|
||||
<option value="url" selected={item.page_id == nil}>Custom URL</option>
|
||||
<option value="page" selected={is_page_link}>Page</option>
|
||||
<option value="url" selected={not is_page_link}>Custom URL</option>
|
||||
</select>
|
||||
<%= if item.page_id != nil or (item.url == "" and @pages != []) do %>
|
||||
<%= if is_page_link or (item.url == "" and @pages != []) do %>
|
||||
<select
|
||||
name={"nav_item[#{item.id}][page_id]"}
|
||||
class="admin-select admin-select-sm site-editor-nav-page"
|
||||
@@ -662,6 +677,9 @@ defmodule BerrypodWeb.ShopComponents.SiteEditor do
|
||||
>
|
||||
<option value="">Select a page</option>
|
||||
<optgroup label="Pages">
|
||||
<option value="/" selected={item.url == "/" or item.url == "home"}>
|
||||
Home
|
||||
</option>
|
||||
<option
|
||||
:for={page <- @pages}
|
||||
value={page.slug}
|
||||
|
||||
Reference in New Issue
Block a user