- <%= for admin <- @admins do %>
- <.user_card user={admin}>
- <.link
- href="#"
- class="text-primary-600 link"
- phx-click="delete_user"
- phx-value-id={admin.id}
- data-confirm={
- dgettext(
- "prompts",
- "Are you sure you want to delete %{email}? This action is permanent!",
- email: admin.email
- )
- }
- >
-
-
-
- <% end %>
+ <.user_card :for={admin <- @admins} user={admin}>
+ <.link
+ href="#"
+ class="text-primary-600 link"
+ phx-click="delete_user"
+ phx-value-id={admin.id}
+ data-confirm={
+ dgettext(
+ "prompts",
+ "Are you sure you want to delete %{email}? This action is permanent!",
+ email: admin.email
+ )
+ }
+ >
+
+
+
<% end %>
@@ -122,39 +116,35 @@
- <%= for user <- @users do %>
- <.user_card user={user}>
- <.link
- href="#"
- class="text-primary-600 link"
- phx-click="delete_user"
- phx-value-id={user.id}
- data-confirm={
- dgettext(
- "prompts",
- "Are you sure you want to delete %{email}? This action is permanent!",
- email: user.email
- )
- }
- >
-
-
-
- <% end %>
+ <.user_card :for={user <- @users} user={user}>
+ <.link
+ href="#"
+ class="text-primary-600 link"
+ phx-click="delete_user"
+ phx-value-id={user.id}
+ data-confirm={
+ dgettext(
+ "prompts",
+ "Are you sure you want to delete %{email}? This action is permanent!",
+ email: user.email
+ )
+ }
+ >
+
+
+
<% end %>
-<%= if @live_action in [:new, :edit] do %>
- <.modal return_to={Routes.invite_index_path(Endpoint, :index)}>
- <.live_component
- module={CanneryWeb.InviteLive.FormComponent}
- id={@invite.id || :new}
- title={@page_title}
- action={@live_action}
- invite={@invite}
- return_to={Routes.invite_index_path(Endpoint, :index)}
- current_user={@current_user}
- />
-
-<% end %>
+<.modal :if={@live_action in [:new, :edit]} return_to={Routes.invite_index_path(Endpoint, :index)}>
+ <.live_component
+ module={CanneryWeb.InviteLive.FormComponent}
+ id={@invite.id || :new}
+ title={@page_title}
+ action={@live_action}
+ invite={@invite}
+ return_to={Routes.invite_index_path(Endpoint, :index)}
+ current_user={@current_user}
+ />
+
diff --git a/lib/cannery_web/live/live_helpers.ex b/lib/cannery_web/live/live_helpers.ex
index 6599bacb..76695a5b 100644
--- a/lib/cannery_web/live/live_helpers.ex
+++ b/lib/cannery_web/live/live_helpers.ex
@@ -31,10 +31,10 @@ defmodule CanneryWeb.LiveHelpers do
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"
+ 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()}
+ 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()}
+ text-gray-500 hover:text-gray-800
+ transition-all duration-500 ease-in-out"
+ phx-remove={hide_modal()}
>
@@ -106,8 +106,8 @@ defmodule CanneryWeb.LiveHelpers do
data-qa={@id}
{
if assigns |> Map.has_key?(:target),
- do: %{"phx-click" => @action, "phx-value-value" => @value, "phx-target" => @target},
- else: %{"phx-click" => @action, "phx-value-value" => @value}
+ do: %{"phx-click": @action, "phx-value-value": @value, "phx-target": @target},
+ else: %{"phx-click": @action, "phx-value-value": @value}
}
/>
-<%= if @live_action in [:edit] do %>
- <.modal return_to={Routes.range_index_path(Endpoint, :index)}>
- <.live_component
- module={CanneryWeb.RangeLive.FormComponent}
- id={@shot_group.id}
- title={@page_title}
- action={@live_action}
- shot_group={@shot_group}
- return_to={Routes.range_index_path(Endpoint, :index)}
- current_user={@current_user}
- />
-
-<% end %>
+<.modal :if={@live_action == :edit} return_to={Routes.range_index_path(Endpoint, :index)}>
+ <.live_component
+ module={CanneryWeb.RangeLive.FormComponent}
+ id={@shot_group.id}
+ title={@page_title}
+ action={@live_action}
+ shot_group={@shot_group}
+ return_to={Routes.range_index_path(Endpoint, :index)}
+ current_user={@current_user}
+ />
+
-<%= if @live_action in [:add_shot_group] do %>
- <.modal return_to={Routes.range_index_path(Endpoint, :index)}>
- <.live_component
- module={CanneryWeb.Components.AddShotGroupComponent}
- id={:new}
- title={@page_title}
- action={@live_action}
- ammo_group={@ammo_group}
- return_to={Routes.range_index_path(Endpoint, :index)}
- current_user={@current_user}
- />
-
-<% end %>
+<.modal
+ :if={@live_action == :add_shot_group}
+ return_to={Routes.range_index_path(Endpoint, :index)}
+>
+ <.live_component
+ module={CanneryWeb.Components.AddShotGroupComponent}
+ id={:new}
+ title={@page_title}
+ action={@live_action}
+ ammo_group={@ammo_group}
+ return_to={Routes.range_index_path(Endpoint, :index)}
+ current_user={@current_user}
+ />
+
diff --git a/lib/cannery_web/live/tag_live/form_component.ex b/lib/cannery_web/live/tag_live/form_component.ex
index 2949272d..86d6b31a 100644
--- a/lib/cannery_web/live/tag_live/form_component.ex
+++ b/lib/cannery_web/live/tag_live/form_component.ex
@@ -50,53 +50,6 @@ defmodule CanneryWeb.TagLive.FormComponent do
socket |> assign(:changeset, changeset)
end
- @impl true
- def render(assigns) do
- ~H"""
-
-
- <%= @title %>
-
- <.form
- :let={f}
- for={@changeset}
- id="tag-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}
- phx-change="validate"
- phx-submit="save"
- >
- <%= if @changeset.action && not @changeset.valid? do %>
-
- <%= changeset_errors(@changeset) %>
-
- <% end %>
-
- <%= label(f, :name, gettext("Name"), class: "title text-lg text-primary-600") %>
- <%= text_input(f, :name, class: "input input-primary col-span-2") %>
- <%= error_tag(f, :name, "col-span-3") %>
-
- <%= label(f, :bg_color, gettext("Background color"), class: "title text-lg text-primary-600") %>
-
- <%= color_input(f, :bg_color) %>
-
- <%= error_tag(f, :bg_color, "col-span-3") %>
-
- <%= label(f, :text_color, gettext("Text color"), class: "title text-lg text-primary-600") %>
-
- <%= color_input(f, :text_color) %>
-
- <%= error_tag(f, :text_color, "col-span-3") %>
-
- <%= submit(dgettext("actions", "Save"),
- class: "mx-auto btn btn-primary col-span-3",
- phx_disable_with: dgettext("prompts", "Saving...")
- ) %>
-
-
- """
- end
-
defp save_tag(
%{assigns: %{tag: tag, current_user: current_user, return_to: return_to}} = socket,
:edit,
diff --git a/lib/cannery_web/live/tag_live/form_component.html.heex b/lib/cannery_web/live/tag_live/form_component.html.heex
new file mode 100644
index 00000000..9923234d
--- /dev/null
+++ b/lib/cannery_web/live/tag_live/form_component.html.heex
@@ -0,0 +1,42 @@
+
+
+ <%= @title %>
+
+ <.form
+ :let={f}
+ for={@changeset}
+ id="tag-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}
+ phx-change="validate"
+ phx-submit="save"
+ >
+
+ <%= changeset_errors(@changeset) %>
+
+
+ <%= label(f, :name, gettext("Name"), class: "title text-lg text-primary-600") %>
+ <%= text_input(f, :name, class: "input input-primary col-span-2") %>
+ <%= error_tag(f, :name, "col-span-3") %>
+
+ <%= label(f, :bg_color, gettext("Background color"), class: "title text-lg text-primary-600") %>
+
+ <%= color_input(f, :bg_color) %>
+
+ <%= error_tag(f, :bg_color, "col-span-3") %>
+
+ <%= label(f, :text_color, gettext("Text color"), class: "title text-lg text-primary-600") %>
+
+ <%= color_input(f, :text_color) %>
+
+ <%= error_tag(f, :text_color, "col-span-3") %>
+
+ <%= submit(dgettext("actions", "Save"),
+ class: "mx-auto btn btn-primary col-span-3",
+ phx_disable_with: dgettext("prompts", "Saving...")
+ ) %>
+
+
diff --git a/lib/cannery_web/live/tag_live/index.html.heex b/lib/cannery_web/live/tag_live/index.html.heex
index 808207be..d9fff26f 100644
--- a/lib/cannery_web/live/tag_live/index.html.heex
+++ b/lib/cannery_web/live/tag_live/index.html.heex
@@ -45,44 +45,40 @@
<% else %>
- <%= for tag <- @tags do %>
- <.tag_card tag={tag}>
- <.link
- patch={Routes.tag_index_path(Endpoint, :edit, tag)}
- class="text-primary-600 link"
- data-qa={"edit-#{tag.id}"}
- >
-
-
+ <.tag_card :for={tag <- @tags} tag={tag}>
+ <.link
+ patch={Routes.tag_index_path(Endpoint, :edit, tag)}
+ class="text-primary-600 link"
+ data-qa={"edit-#{tag.id}"}
+ >
+
+
- <.link
- href="#"
- class="text-primary-600 link"
- phx-click="delete"
- phx-value-id={tag.id}
- data-confirm={
- dgettext("prompts", "Are you sure you want to delete %{name}?", name: tag.name)
- }
- data-qa={"delete-#{tag.id}"}
- >
-
-
-
- <% end %>
+ <.link
+ href="#"
+ class="text-primary-600 link"
+ phx-click="delete"
+ phx-value-id={tag.id}
+ data-confirm={
+ dgettext("prompts", "Are you sure you want to delete %{name}?", name: tag.name)
+ }
+ data-qa={"delete-#{tag.id}"}
+ >
+
+
+
<% end %>
-<%= if @live_action in [:new, :edit] do %>
- <.modal return_to={Routes.tag_index_path(Endpoint, :index)}>
- <.live_component
- module={CanneryWeb.TagLive.FormComponent}
- id={@tag.id || :new}
- title={@page_title}
- action={@live_action}
- tag={@tag}
- return_to={Routes.tag_index_path(Endpoint, :index)}
- current_user={@current_user}
- />
-
-<% end %>
+<.modal :if={@live_action in [:new, :edit]} return_to={Routes.tag_index_path(Endpoint, :index)}>
+ <.live_component
+ module={CanneryWeb.TagLive.FormComponent}
+ id={@tag.id || :new}
+ title={@page_title}
+ action={@live_action}
+ tag={@tag}
+ return_to={Routes.tag_index_path(Endpoint, :index)}
+ current_user={@current_user}
+ />
+
diff --git a/lib/cannery_web/templates/error/error.html.heex b/lib/cannery_web/templates/error/error.html.heex
index dea1c8cc..11c6cefa 100644
--- a/lib/cannery_web/templates/error/error.html.heex
+++ b/lib/cannery_web/templates/error/error.html.heex
@@ -5,7 +5,7 @@