From 69240c1d51455caf802f5bff49dd1f11b8fc0831 Mon Sep 17 00:00:00 2001 From: shibao Date: Thu, 17 Feb 2022 22:31:37 -0500 Subject: [PATCH] use Endpoint for links --- .../components/move_ammo_group_component.html.heex | 2 +- lib/cannery_web/live/ammo_group_live/index.html.heex | 10 +++++----- lib/cannery_web/live/ammo_type_live/index.html.heex | 8 ++++---- lib/cannery_web/live/ammo_type_live/show.html.heex | 2 +- lib/cannery_web/live/container_live/index.ex | 1 + lib/cannery_web/live/container_live/index.html.heex | 10 +++++----- lib/cannery_web/live/container_live/show.html.heex | 2 +- lib/cannery_web/live/invite_live/index.html.heex | 8 ++++---- lib/cannery_web/live/live_helpers.ex | 4 ++-- lib/cannery_web/live/tag_live/index.html.heex | 8 ++++---- 10 files changed, 28 insertions(+), 27 deletions(-) diff --git a/lib/cannery_web/components/move_ammo_group_component.html.heex b/lib/cannery_web/components/move_ammo_group_component.html.heex index ae5db794..274096c9 100644 --- a/lib/cannery_web/components/move_ammo_group_component.html.heex +++ b/lib/cannery_web/components/move_ammo_group_component.html.heex @@ -10,7 +10,7 @@ <%= live_patch(dgettext("actions", "Add another container!"), - to: Routes.container_index_path(@socket, :new), + to: Routes.container_index_path(Endpoint, :new), class: "btn btn-primary" ) %> <% else %> diff --git a/lib/cannery_web/live/ammo_group_live/index.html.heex b/lib/cannery_web/live/ammo_group_live/index.html.heex index 55977bc0..3377f6cc 100644 --- a/lib/cannery_web/live/ammo_group_live/index.html.heex +++ b/lib/cannery_web/live/ammo_group_live/index.html.heex @@ -10,12 +10,12 @@ <%= live_patch(dgettext("actions", "Add your first box!"), - to: Routes.ammo_group_index_path(@socket, :new), + to: Routes.ammo_group_index_path(Endpoint, :new), class: "btn btn-primary" ) %> <% else %> <%= live_patch(dgettext("actions", "New Ammo group"), - to: Routes.ammo_group_index_path(@socket, :new), + to: Routes.ammo_group_index_path(Endpoint, :new), class: "btn btn-primary" ) %> @@ -92,7 +92,7 @@ <%= if ammo_group.container do %> <%= live_patch(ammo_group.container.name, - to: Routes.ammo_group_index_path(@socket, :move, ammo_group), + to: Routes.ammo_group_index_path(Endpoint, :move, ammo_group), class: "btn btn-primary" ) %> <% end %> @@ -100,13 +100,13 @@
- <%= live_redirect to: Routes.ammo_group_show_path(@socket, :show, ammo_group), + <%= live_redirect to: Routes.ammo_group_show_path(Endpoint, :show, ammo_group), class: "text-primary-600 link", data: [qa: "view-#{ammo_group.id}"] do %> <% end %> - <%= live_patch to: Routes.ammo_group_index_path(@socket, :edit, ammo_group), + <%= live_patch to: Routes.ammo_group_index_path(Endpoint, :edit, ammo_group), class: "text-primary-600 link", data: [qa: "edit-#{ammo_group.id}"] do %> diff --git a/lib/cannery_web/live/ammo_type_live/index.html.heex b/lib/cannery_web/live/ammo_type_live/index.html.heex index 44db4f55..bd748772 100644 --- a/lib/cannery_web/live/ammo_type_live/index.html.heex +++ b/lib/cannery_web/live/ammo_type_live/index.html.heex @@ -10,12 +10,12 @@ <%= live_patch(dgettext("actions", "Add your first type!"), - to: Routes.ammo_type_index_path(@socket, :new), + to: Routes.ammo_type_index_path(Endpoint, :new), class: "btn btn-primary" ) %> <% else %> <%= live_patch(dgettext("actions", "New Ammo type"), - to: Routes.ammo_type_index_path(@socket, :new), + to: Routes.ammo_type_index_path(Endpoint, :new), class: "btn btn-primary" ) %> @@ -48,13 +48,13 @@
- <%= live_redirect to: Routes.ammo_type_show_path(@socket, :show, ammo_type), + <%= live_redirect to: Routes.ammo_type_show_path(Endpoint, :show, ammo_type), class: "text-primary-600 link", data: [qa: "view-#{ammo_type.id}"] do %> <% end %> - <%= live_patch to: Routes.ammo_type_index_path(@socket, :edit, ammo_type), + <%= live_patch to: Routes.ammo_type_index_path(Endpoint, :edit, ammo_type), class: "text-primary-600 link", data: [qa: "edit-#{ammo_type.id}"] do %> diff --git a/lib/cannery_web/live/ammo_type_live/show.html.heex b/lib/cannery_web/live/ammo_type_live/show.html.heex index a54b9115..d86d8d10 100644 --- a/lib/cannery_web/live/ammo_type_live/show.html.heex +++ b/lib/cannery_web/live/ammo_type_live/show.html.heex @@ -15,7 +15,7 @@ <% end %>
- <%= live_patch to: Routes.ammo_type_show_path(@socket, :edit, @ammo_type), + <%= live_patch to: Routes.ammo_type_show_path(Endpoint, :edit, @ammo_type), class: "text-primary-600 link", data: [qa: "edit"] do %> diff --git a/lib/cannery_web/live/container_live/index.ex b/lib/cannery_web/live/container_live/index.ex index 485739ef..2521ca2c 100644 --- a/lib/cannery_web/live/container_live/index.ex +++ b/lib/cannery_web/live/container_live/index.ex @@ -6,6 +6,7 @@ defmodule CanneryWeb.ContainerLive.Index do use CanneryWeb, :live_view import CanneryWeb.Components.ContainerCard alias Cannery.{Containers, Containers.Container} + alias CanneryWeb.Endpoint alias Ecto.Changeset @impl true diff --git a/lib/cannery_web/live/container_live/index.html.heex b/lib/cannery_web/live/container_live/index.html.heex index 3bd649d1..8ecb4559 100644 --- a/lib/cannery_web/live/container_live/index.html.heex +++ b/lib/cannery_web/live/container_live/index.html.heex @@ -10,12 +10,12 @@ <%= live_patch(dgettext("actions", "Add your first container!"), - to: Routes.container_index_path(@socket, :new), + to: Routes.container_index_path(Endpoint, :new), class: "btn btn-primary" ) %> <% else %> <%= live_patch(dgettext("actions", "New Container"), - to: Routes.container_index_path(@socket, :new), + to: Routes.container_index_path(Endpoint, :new), class: "btn btn-primary" ) %> <% end %> @@ -23,7 +23,7 @@
<%= for container <- @containers do %> <.container_card container={container}> - <%= live_patch to: Routes.container_index_path(@socket, :edit, container), + <%= live_patch to: Routes.container_index_path(Endpoint, :edit, container), class: "text-primary-600 link", data: [qa: "edit-#{container.id}"] do %> @@ -46,14 +46,14 @@
<%= if @live_action in [:new, :edit] do %> - <.modal return_to={Routes.container_index_path(@socket, :index)}> + <.modal return_to={Routes.container_index_path(Endpoint, :index)}> <.live_component module={CanneryWeb.ContainerLive.FormComponent} id={@container.id || :new} title={@page_title} action={@live_action} container={@container} - return_to={Routes.container_index_path(@socket, :index)} + return_to={Routes.container_index_path(Endpoint, :index)} current_user={@current_user} /> diff --git a/lib/cannery_web/live/container_live/show.html.heex b/lib/cannery_web/live/container_live/show.html.heex index a8c847c8..450d22f0 100644 --- a/lib/cannery_web/live/container_live/show.html.heex +++ b/lib/cannery_web/live/container_live/show.html.heex @@ -23,7 +23,7 @@ <% end %>
- <%= live_patch to: Routes.container_show_path(@socket, :edit, @container), + <%= live_patch to: Routes.container_show_path(Endpoint, :edit, @container), class: "text-primary-600 link", data: [qa: "edit"] do %> diff --git a/lib/cannery_web/live/invite_live/index.html.heex b/lib/cannery_web/live/invite_live/index.html.heex index da15124d..c88eadb9 100644 --- a/lib/cannery_web/live/invite_live/index.html.heex +++ b/lib/cannery_web/live/invite_live/index.html.heex @@ -10,12 +10,12 @@ <%= live_patch(dgettext("actions", "Invite someone new!"), - to: Routes.invite_index_path(@socket, :new), + to: Routes.invite_index_path(Endpoint, :new), class: "btn btn-primary" ) %> <% else %> <%= live_patch(dgettext("actions", "Create Invite"), - to: Routes.invite_index_path(@socket, :new), + to: Routes.invite_index_path(Endpoint, :new), class: "btn btn-primary" ) %> <% end %> @@ -144,14 +144,14 @@
<%= if @live_action in [:new, :edit] do %> - <.modal return_to={Routes.invite_index_path(@socket, :index)}> + <.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(@socket, :index)} + 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 1df5f04c..c58ad61e 100644 --- a/lib/cannery_web/live/live_helpers.ex +++ b/lib/cannery_web/live/live_helpers.ex @@ -25,13 +25,13 @@ defmodule CanneryWeb.LiveHelpers do ## Examples - <.modal return_to={Routes.<%= schema.singular %>_index_path(@socket, :index)}> + <.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(@socket, :index)} + return_to={Routes.<%= schema.singular %>_index_path(Endpoint, :index)} <%= schema.singular %>: @<%= schema.singular %> /> diff --git a/lib/cannery_web/live/tag_live/index.html.heex b/lib/cannery_web/live/tag_live/index.html.heex index 35876016..e67162a9 100644 --- a/lib/cannery_web/live/tag_live/index.html.heex +++ b/lib/cannery_web/live/tag_live/index.html.heex @@ -12,12 +12,12 @@ <%= live_patch(dgettext("actions", "Make your first tag!"), - to: Routes.tag_index_path(@socket, :new), + to: Routes.tag_index_path(Endpoint, :new), class: "btn btn-primary" ) %> <% else %> <%= live_patch(dgettext("actions", "New Tag"), - to: Routes.tag_index_path(@socket, :new), + to: Routes.tag_index_path(Endpoint, :new), class: "btn btn-primary" ) %> <% end %> @@ -46,14 +46,14 @@
<%= if @live_action in [:new, :edit] do %> - <.modal return_to={Routes.tag_index_path(@socket, :index)}> + <.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(@socket, :index)} + return_to={Routes.tag_index_path(Endpoint, :index)} current_user={@current_user} />