From d01df0b9fd8bbc5fa1dfacd4428cb4768f8ac80b Mon Sep 17 00:00:00 2001 From: APB9785 <74077809+APB9785@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:59:31 -0600 Subject: [PATCH] fix form params to include schema --- lib/beacon/live_admin/live/error_page_editor_live/index.ex | 3 ++- lib/beacon/live_admin/live/event_handler_editor_live/index.ex | 3 ++- lib/beacon/live_admin/live/info_handler_editor_live/index.ex | 3 ++- .../live_admin/live/error_page_editor_live/index_test.exs | 2 +- .../live_admin/live/event_handler_editor_live/index_test.exs | 2 +- .../live_admin/live/info_handler_editor_live/index_test.exs | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/beacon/live_admin/live/error_page_editor_live/index.ex b/lib/beacon/live_admin/live/error_page_editor_live/index.ex index 9b915339..a1a69be8 100644 --- a/lib/beacon/live_admin/live/error_page_editor_live/index.ex +++ b/lib/beacon/live_admin/live/error_page_editor_live/index.ex @@ -64,8 +64,9 @@ defmodule Beacon.LiveAdmin.ErrorPageEditorLive.Index do {:noreply, assign(socket, show_status_change_field: true)} end - def handle_event("save_new", %{"status" => status}, socket) do + def handle_event("save_new", params, socket) do %{beacon_page: %{site: site}, layouts: layouts} = socket.assigns + %{"error_page" => %{"status" => status}} = params attrs = %{ "status" => status, diff --git a/lib/beacon/live_admin/live/event_handler_editor_live/index.ex b/lib/beacon/live_admin/live/event_handler_editor_live/index.ex index 57a6703e..d74846dc 100644 --- a/lib/beacon/live_admin/live/event_handler_editor_live/index.ex +++ b/lib/beacon/live_admin/live/event_handler_editor_live/index.ex @@ -54,8 +54,9 @@ defmodule Beacon.LiveAdmin.EventHandlerEditorLive.Index do {:noreply, assign(socket, show_create_modal: true)} end - def handle_event("save_new", %{"name" => name}, socket) do + def handle_event("save_new", params, socket) do %{beacon_page: %{site: site}} = socket.assigns + %{"event_handler" => %{"name" => name}} = params attrs = %{ "name" => name, diff --git a/lib/beacon/live_admin/live/info_handler_editor_live/index.ex b/lib/beacon/live_admin/live/info_handler_editor_live/index.ex index 709e1d82..221a43c2 100644 --- a/lib/beacon/live_admin/live/info_handler_editor_live/index.ex +++ b/lib/beacon/live_admin/live/info_handler_editor_live/index.ex @@ -48,8 +48,9 @@ defmodule Beacon.LiveAdmin.InfoHandlerEditorLive.Index do {:noreply, assign(socket, show_create_modal: false)} end - def handle_event("save_new", %{"msg" => msg}, socket) do + def handle_event("save_new", params, socket) do %{beacon_page: %{site: site}} = socket.assigns + %{"info_handler" => %{"msg" => msg}} = params attrs = %{ "msg" => msg, diff --git a/test/beacon/live_admin/live/error_page_editor_live/index_test.exs b/test/beacon/live_admin/live/error_page_editor_live/index_test.exs index 4e9d9673..097ffb84 100644 --- a/test/beacon/live_admin/live/error_page_editor_live/index_test.exs +++ b/test/beacon/live_admin/live/error_page_editor_live/index_test.exs @@ -39,7 +39,7 @@ defmodule Beacon.LiveAdmin.ErrorPageEditorLive.IndexTest do {:ok, view, _html} = view - |> form("#create-form", %{status: 400}) + |> form("#create-form", %{error_page: %{status: 400}}) |> render_submit() |> follow_redirect(conn, "/admin/site_a/error_pages/400") diff --git a/test/beacon/live_admin/live/event_handler_editor_live/index_test.exs b/test/beacon/live_admin/live/event_handler_editor_live/index_test.exs index efb4a0ce..b0a72011 100644 --- a/test/beacon/live_admin/live/event_handler_editor_live/index_test.exs +++ b/test/beacon/live_admin/live/event_handler_editor_live/index_test.exs @@ -32,7 +32,7 @@ defmodule Beacon.LiveAdmin.EventHandlerEditorLive.IndexTest do {:ok, view, _html} = view - |> form("#create-form", %{name: "my_test"}) + |> form("#create-form", %{event_handler: %{name: "my_test"}}) |> render_submit() |> follow_redirect(conn) diff --git a/test/beacon/live_admin/live/info_handler_editor_live/index_test.exs b/test/beacon/live_admin/live/info_handler_editor_live/index_test.exs index ae04e9a6..6536e797 100644 --- a/test/beacon/live_admin/live/info_handler_editor_live/index_test.exs +++ b/test/beacon/live_admin/live/info_handler_editor_live/index_test.exs @@ -47,7 +47,7 @@ defmodule Beacon.LiveAdmin.InfoHandlerEditorLive.IndexTest do view = {:error, {:live_redirect, %{to: path}}} = view - |> form("#create-form", %{msg: "{:assign_email, email}"}) + |> form("#create-form", %{info_handler: %{msg: "{:assign_email, email}"}}) |> render_submit() {:ok, view, _html} =