From 05fc94894d60f4b4abcfb5e40092d1f3806767a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Dos=C3=A9?= Date: Sun, 17 Mar 2024 20:05:49 -0700 Subject: [PATCH] Update add/remove inputs to match updated Phoenix recommendations (#816) --- lib/ambry_web/components/admin/components.ex | 56 ++++++++++--------- .../live/admin/book_live/form.html.heex | 16 +++--- .../live/admin/media_live/chapters.html.heex | 8 +-- .../live/admin/media_live/form.html.heex | 19 +++---- .../live/admin/person_live/form.html.heex | 16 +++--- .../live/admin/series_live/form.html.heex | 8 +-- 6 files changed, 63 insertions(+), 60 deletions(-) diff --git a/lib/ambry_web/components/admin/components.ex b/lib/ambry_web/components/admin/components.ex index df35ca9b..8a717b84 100644 --- a/lib/ambry_web/components/admin/components.ex +++ b/lib/ambry_web/components/admin/components.ex @@ -3,7 +3,6 @@ defmodule AmbryWeb.Admin.Components do use AmbryWeb, :html - alias Phoenix.HTML.Form alias Phoenix.HTML.FormField def admin_table_header(assigns) do @@ -230,49 +229,56 @@ defmodule AmbryWeb.Admin.Components do """ end - attr :drop_param, :atom, required: true - attr :parent_form, Form, required: true - attr :form, Form, required: true - attr :class, :string, default: nil, doc: "class overrides" + attr :field, FormField, required: true - def delete_button(assigns) do + def delete_input(assigns) do ~H""" - + "[]"} /> """ end - attr :drop_param, :atom, required: true - attr :form, Form, required: true + attr :field, FormField, required: true + attr :index, :integer, required: true - def delete_input(assigns) do + def sort_input(assigns) do ~H""" - "[]"} /> + "[]"} value={@index} /> """ end - attr :sort_param, :atom, required: true - attr :parent_form, Form, required: true - attr :form, Form, required: true + attr :field, FormField, required: true + attr :index, :integer, required: true + attr :class, :string, default: nil, doc: "class overrides" - def sort_input(assigns) do + def delete_button(assigns) do ~H""" - "[]"} value={@form.index} /> + """ end - attr :sort_param, :atom, required: true - attr :form, Form, required: true - attr :label, :string, required: true + attr :field, FormField, required: true + slot :inner_block, required: true def add_button(assigns) do ~H""" -