migrate admin forms to inline feedback
All checks were successful
deploy / deploy (push) Successful in 1m26s
All checks were successful
deploy / deploy (push) Successful in 1m26s
Replace put_flash calls with inline feedback for form saves: - Email settings: "Now send a test email" after saving - Settings: from address and signing secret saves - Page editor: save button shows "Saved" checkmark Inline feedback appears next to save buttons and auto-clears after 3 seconds. Banners (put_flash) remain for page-level outcomes like deletions, state changes, and async operations. Task 3 of notification overhaul. Theme editor skipped as it auto-saves. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ defmodule BerrypodWeb.Admin.Pages.Editor do
|
||||
|> assign(:history, [])
|
||||
|> assign(:future, [])
|
||||
|> assign(:dirty, false)
|
||||
|> assign(:save_status, :idle)
|
||||
|> assign(:show_picker, false)
|
||||
|> assign(:picker_filter, "")
|
||||
|> assign(:expanded, MapSet.new())
|
||||
@@ -383,13 +384,18 @@ defmodule BerrypodWeb.Admin.Pages.Editor do
|
||||
|
||||
case Pages.save_page(slug, %{title: page_data.title, blocks: blocks}) do
|
||||
{:ok, _page} ->
|
||||
Process.send_after(self(), :clear_save_status, 3000)
|
||||
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(:dirty, false)
|
||||
|> put_flash(:info, "Page saved")}
|
||||
|> assign(:save_status, :saved)}
|
||||
|
||||
{:error, _changeset} ->
|
||||
{:noreply, put_flash(socket, :error, "Failed to save page")}
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(:save_status, :error)
|
||||
|> put_flash(:error, "Failed to save page")}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -515,6 +521,13 @@ defmodule BerrypodWeb.Admin.Pages.Editor do
|
||||
end
|
||||
end
|
||||
|
||||
# ── Handle info ──────────────────────────────────────────────────
|
||||
|
||||
@impl true
|
||||
def handle_info(:clear_save_status, socket) do
|
||||
{:noreply, assign(socket, :save_status, :idle)}
|
||||
end
|
||||
|
||||
# ── Render ───────────────────────────────────────────────────────
|
||||
|
||||
@impl true
|
||||
@@ -586,6 +599,7 @@ defmodule BerrypodWeb.Admin.Pages.Editor do
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
<.inline_feedback status={@save_status} />
|
||||
</:actions>
|
||||
</.header>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user