use Endpoint for links

This commit is contained in:
shibao 2022-02-17 22:31:37 -05:00
parent 3164d48f6c
commit 69240c1d51
10 changed files with 28 additions and 27 deletions

View File

@ -10,7 +10,7 @@
</h2>
<%= 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 %>

View File

@ -10,12 +10,12 @@
</h2>
<%= 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 @@
<td class="p-2">
<%= 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 @@
<td class="p-2">
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<%= 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 %>
<i class="fa-fw fa-lg fas fa-eye"></i>
<% 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 %>
<i class="fa-fw fa-lg fas fa-edit"></i>

View File

@ -10,12 +10,12 @@
</h2>
<%= 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 @@
<td class="p-2">
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<%= 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 %>
<i class="fa-fw fa-lg fas fa-eye"></i>
<% 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 %>
<i class="fa-fw fa-lg fas fa-edit"></i>

View File

@ -15,7 +15,7 @@
<% end %>
<div class="flex space-x-4 justify-center items-center text-primary-600">
<%= 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 %>
<i class="fa-fw fa-lg fas fa-edit"></i>

View File

@ -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

View File

@ -10,12 +10,12 @@
</h2>
<%= 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 @@
<div class="flex flex-row flex-wrap justify-center items-center">
<%= 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 %>
<i class="fa-fw fa-lg fas fa-edit"></i>
@ -46,14 +46,14 @@
</div>
<%= 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}
/>
</.modal>

View File

@ -23,7 +23,7 @@
<% end %>
<div class="flex space-x-4 justify-center items-center text-primary-600">
<%= 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 %>
<i class="fa-fw fa-lg fas fa-edit"></i>

View File

@ -10,12 +10,12 @@
</h1>
<%= 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 @@
</div>
<%= 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}
/>
</.modal>

View File

@ -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 %>
/>
</.modal>

View File

@ -12,12 +12,12 @@
</h2>
<%= 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 @@
</div>
<%= 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}
/>
</.modal>