Skip to content

Commit

Permalink
fix form params to include schema
Browse files Browse the repository at this point in the history
  • Loading branch information
APB9785 committed Dec 17, 2024
1 parent 7df5992 commit d01df0b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/beacon/live_admin/live/error_page_editor_live/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion lib/beacon/live_admin/live/info_handler_editor_live/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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} =
Expand Down

0 comments on commit d01df0b

Please sign in to comment.