<.form
:let={f}
- for={:search}
+ for={%{}}
+ as={:search}
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
diff --git a/lib/cannery_web/live/ammo_type_live/show.ex b/lib/cannery_web/live/ammo_type_live/show.ex
index c475de98..e2590f93 100644
--- a/lib/cannery_web/live/ammo_type_live/show.ex
+++ b/lib/cannery_web/live/ammo_type_live/show.ex
@@ -4,7 +4,6 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
"""
use CanneryWeb, :live_view
- import CanneryWeb.Components.AmmoGroupCard
alias Cannery.{Ammo, Ammo.AmmoType}
alias CanneryWeb.Endpoint
diff --git a/lib/cannery_web/live/container_live/edit_tags_component.html.heex b/lib/cannery_web/live/container_live/edit_tags_component.html.heex
index 2583aeab..4cdef7fe 100644
--- a/lib/cannery_web/live/container_live/edit_tags_component.html.heex
+++ b/lib/cannery_web/live/container_live/edit_tags_component.html.heex
@@ -36,7 +36,8 @@
<.form
:let={f}
- for={:tag}
+ for={%{}}
+ as={:tag}
id="add-tag-to-container-form"
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
phx-target={@myself}
diff --git a/lib/cannery_web/live/container_live/index.ex b/lib/cannery_web/live/container_live/index.ex
index 98b06653..37f4852e 100644
--- a/lib/cannery_web/live/container_live/index.ex
+++ b/lib/cannery_web/live/container_live/index.ex
@@ -4,7 +4,6 @@ defmodule CanneryWeb.ContainerLive.Index do
"""
use CanneryWeb, :live_view
- import CanneryWeb.Components.ContainerCard
alias Cannery.{Containers, Containers.Container, Repo}
alias Ecto.Changeset
diff --git a/lib/cannery_web/live/container_live/index.html.heex b/lib/cannery_web/live/container_live/index.html.heex
index 1579af30..084da1ab 100644
--- a/lib/cannery_web/live/container_live/index.html.heex
+++ b/lib/cannery_web/live/container_live/index.html.heex
@@ -20,7 +20,8 @@
<.form
:let={f}
- for={:search}
+ for={%{}}
+ as={:search}
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
diff --git a/lib/cannery_web/live/container_live/show.ex b/lib/cannery_web/live/container_live/show.ex
index 80722036..ec64cc2e 100644
--- a/lib/cannery_web/live/container_live/show.ex
+++ b/lib/cannery_web/live/container_live/show.ex
@@ -4,7 +4,6 @@ defmodule CanneryWeb.ContainerLive.Show do
"""
use CanneryWeb, :live_view
- import CanneryWeb.Components.{AmmoGroupCard, TagCard}
alias Cannery.{Accounts.User, Ammo, Containers, Containers.Container, Repo, Tags}
alias CanneryWeb.Endpoint
alias Ecto.Changeset
diff --git a/lib/cannery_web/live/invite_live/index.ex b/lib/cannery_web/live/invite_live/index.ex
index b402eb6f..507d978f 100644
--- a/lib/cannery_web/live/invite_live/index.ex
+++ b/lib/cannery_web/live/invite_live/index.ex
@@ -4,7 +4,6 @@ defmodule CanneryWeb.InviteLive.Index do
"""
use CanneryWeb, :live_view
- import CanneryWeb.Components.{InviteCard, UserCard}
alias Cannery.Accounts
alias Cannery.Accounts.{Invite, Invites}
alias CanneryWeb.HomeLive
diff --git a/lib/cannery_web/live/live_helpers.ex b/lib/cannery_web/live/live_helpers.ex
deleted file mode 100644
index db8f4eb4..00000000
--- a/lib/cannery_web/live/live_helpers.ex
+++ /dev/null
@@ -1,136 +0,0 @@
-defmodule CanneryWeb.LiveHelpers do
- @moduledoc """
- Contains common helper functions for liveviews
- """
-
- use Phoenix.Component
- alias Phoenix.LiveView.JS
-
- attr :return_to, :string, required: true
- slot(:inner_block)
-
- @doc """
- Renders a live component inside a modal.
-
- The rendered modal receives a `:return_to` option to properly update
- the URL when the modal is closed.
-
- ## Examples
-
- <.modal return_to={Routes.<%= schema.singular %>_index_path(Endpoint, :index)}>
- <.live_component
- module={<%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent}
- id={@<%= schema.singular %>.id || :new}
- title={@page_title}
- action={@live_action}
- return_to={Routes.<%= schema.singular %>_index_path(Endpoint, :index)}
- <%= schema.singular %>: @<%= schema.singular %>
- />
-
- """
- def modal(assigns) do
- ~H"""
- <.link
- patch={@return_to}
- id="modal-bg"
- class="fade-in fixed z-10 left-0 top-0
- w-full h-full overflow-hidden
- p-8 flex flex-col justify-center items-center cursor-auto"
- style="background-color: rgba(0,0,0,0.4);"
- phx-remove={hide_modal()}
- >
-
-
-
-
-
- <.link
- patch={@return_to}
- id="close"
- class="absolute top-8 right-10
- text-gray-500 hover:text-gray-800
- transition-all duration-500 ease-in-out"
- phx-remove={hide_modal()}
- >
-
-
-
-
- <%= render_slot(@inner_block) %>
-
-
-
- """
- end
-
- defp hide_modal(js \\ %JS{}) do
- js
- |> JS.hide(to: "#modal", transition: "fade-out")
- |> JS.hide(to: "#modal-bg", transition: "fade-out")
- |> JS.hide(to: "#modal-content", transition: "fade-out-scale")
- end
-
- attr :action, :string, required: true
- attr :value, :boolean, required: true
- attr :id, :string
- slot(:inner_block)
-
- @doc """
- A toggle button element that can be directed to a liveview or a
- live_component's `handle_event/3`.
-
- ## Examples
-
- <.toggle_button action="my_liveview_action" value={@some_value}>
-
Toggle me!
-
- <.toggle_button action="my_live_component_action" target={@myself} value={@some_value}>
-
Whatever you want
-
- """
- def toggle_button(assigns) do
- assigns = assigns |> assign_new(:id, fn -> assigns.action end)
-
- ~H"""
-
- """
- end
-end
diff --git a/lib/cannery_web/live/range_live/index.ex b/lib/cannery_web/live/range_live/index.ex
index b4bdba10..a6a8b023 100644
--- a/lib/cannery_web/live/range_live/index.ex
+++ b/lib/cannery_web/live/range_live/index.ex
@@ -4,7 +4,6 @@ defmodule CanneryWeb.RangeLive.Index do
"""
use CanneryWeb, :live_view
- import CanneryWeb.Components.AmmoGroupCard
alias Cannery.{ActivityLog, ActivityLog.ShotGroup, Ammo, Repo}
alias CanneryWeb.Endpoint
alias Phoenix.LiveView.Socket
diff --git a/lib/cannery_web/live/range_live/index.html.heex b/lib/cannery_web/live/range_live/index.html.heex
index 07fa17d5..42217a16 100644
--- a/lib/cannery_web/live/range_live/index.html.heex
+++ b/lib/cannery_web/live/range_live/index.html.heex
@@ -70,7 +70,8 @@
<.form
:let={f}
- for={:search}
+ for={%{}}
+ as={:search}
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
diff --git a/lib/cannery_web/live/tag_live/index.ex b/lib/cannery_web/live/tag_live/index.ex
index e4923856..e31dc026 100644
--- a/lib/cannery_web/live/tag_live/index.ex
+++ b/lib/cannery_web/live/tag_live/index.ex
@@ -4,7 +4,6 @@ defmodule CanneryWeb.TagLive.Index do
"""
use CanneryWeb, :live_view
- import CanneryWeb.Components.TagCard
alias Cannery.{Tags, Tags.Tag}
alias CanneryWeb.ViewHelpers
diff --git a/lib/cannery_web/live/tag_live/index.html.heex b/lib/cannery_web/live/tag_live/index.html.heex
index 941ff3ba..eef2e7e0 100644
--- a/lib/cannery_web/live/tag_live/index.html.heex
+++ b/lib/cannery_web/live/tag_live/index.html.heex
@@ -23,7 +23,8 @@
<.form
:let={f}
- for={:search}
+ for={%{}}
+ as={:search}
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
diff --git a/lib/cannery_web/templates/user_confirmation/new.html.heex b/lib/cannery_web/templates/user_confirmation/new.html.heex
index 6d72fe05..441fc5f2 100644
--- a/lib/cannery_web/templates/user_confirmation/new.html.heex
+++ b/lib/cannery_web/templates/user_confirmation/new.html.heex
@@ -5,7 +5,8 @@
<.form
:let={f}
- for={:user}
+ for={%{}}
+ as={:user}
action={Routes.user_confirmation_path(@conn, :create)}
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
diff --git a/lib/cannery_web/templates/user_reset_password/new.html.heex b/lib/cannery_web/templates/user_reset_password/new.html.heex
index 3c18a589..436fa2ff 100644
--- a/lib/cannery_web/templates/user_reset_password/new.html.heex
+++ b/lib/cannery_web/templates/user_reset_password/new.html.heex
@@ -5,7 +5,8 @@
<.form
:let={f}
- for={:user}
+ for={%{}}
+ as={:user}
action={Routes.user_reset_password_path(@conn, :create)}
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
diff --git a/lib/cannery_web/views/error_view.ex b/lib/cannery_web/views/error_view.ex
index 377a7294..413b46d9 100644
--- a/lib/cannery_web/views/error_view.ex
+++ b/lib/cannery_web/views/error_view.ex
@@ -1,6 +1,5 @@
defmodule CanneryWeb.ErrorView do
use CanneryWeb, :view
- import CanneryWeb.Components.Topbar
alias CanneryWeb.HomeLive
def template_not_found(error_path, _assigns) do
diff --git a/lib/cannery_web/views/layout_view.ex b/lib/cannery_web/views/layout_view.ex
index 29531d19..ccf9dad6 100644
--- a/lib/cannery_web/views/layout_view.ex
+++ b/lib/cannery_web/views/layout_view.ex
@@ -1,6 +1,5 @@
defmodule CanneryWeb.LayoutView do
use CanneryWeb, :view
- import CanneryWeb.Components.Topbar
alias CanneryWeb.HomeLive
# Phoenix LiveDashboard is available only in development by default,
diff --git a/lib/cannery_web/views/view_helpers.ex b/lib/cannery_web/views/view_helpers.ex
index 34515639..4ecbef0d 100644
--- a/lib/cannery_web/views/view_helpers.ex
+++ b/lib/cannery_web/views/view_helpers.ex
@@ -7,61 +7,6 @@ defmodule CanneryWeb.ViewHelpers do
use Phoenix.Component
- @doc """
- Phoenix.Component for a