upgrade to phoenix 1.7
This commit is contained in:
@ -105,12 +105,11 @@ defmodule CanneryWeb.ContainerLive.Index do
|
||||
end
|
||||
|
||||
def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
|
||||
{:noreply, socket |> push_patch(to: Routes.container_index_path(Endpoint, :index))}
|
||||
{:noreply, socket |> push_patch(to: ~p"/containers")}
|
||||
end
|
||||
|
||||
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
|
||||
{:noreply,
|
||||
socket |> push_patch(to: Routes.container_index_path(Endpoint, :search, search_term))}
|
||||
{:noreply, socket |> push_patch(to: ~p"/containers/search/#{search_term}")}
|
||||
end
|
||||
|
||||
defp display_containers(%{assigns: %{search: search, current_user: current_user}} = socket) do
|
||||
|
@ -9,11 +9,11 @@
|
||||
<%= display_emoji("😔") %>
|
||||
</h2>
|
||||
|
||||
<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<.link patch={~p"/containers/new"} class="btn btn-primary">
|
||||
<%= dgettext("actions", "Add your first container!") %>
|
||||
</.link>
|
||||
<% else %>
|
||||
<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<.link patch={~p"/containers/new"} class="btn btn-primary">
|
||||
<%= dgettext("actions", "New Container") %>
|
||||
</.link>
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
<:tag_actions :let={container}>
|
||||
<div class="mx-4 my-2">
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
|
||||
patch={~p"/containers/edit_tags/#{container}"}
|
||||
class="text-primary-600 link"
|
||||
aria-label={
|
||||
dgettext("actions", "Tag %{container_name}", container_name: container.name)
|
||||
@ -71,7 +71,7 @@
|
||||
</:tag_actions>
|
||||
<:actions :let={container}>
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :edit, container)}
|
||||
patch={~p"/containers/edit/#{container}"}
|
||||
class="text-primary-600 link"
|
||||
aria-label={
|
||||
dgettext("actions", "Edit %{container_name}", container_name: container.name)
|
||||
@ -81,7 +81,7 @@
|
||||
</.link>
|
||||
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :clone, container)}
|
||||
patch={~p"/containers/clone/#{container}"}
|
||||
class="text-primary-600 link"
|
||||
aria-label={
|
||||
dgettext("actions", "Clone %{container_name}", container_name: container.name)
|
||||
@ -118,7 +118,7 @@
|
||||
<:tag_actions>
|
||||
<div class="mx-4 my-2">
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
|
||||
patch={~p"/containers/edit_tags/#{container}"}
|
||||
class="text-primary-600 link"
|
||||
aria-label={
|
||||
dgettext("actions", "Tag %{container_name}", container_name: container.name)
|
||||
@ -129,7 +129,7 @@
|
||||
</div>
|
||||
</:tag_actions>
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :edit, container)}
|
||||
patch={~p"/containers/edit/#{container}"}
|
||||
class="text-primary-600 link"
|
||||
aria-label={
|
||||
dgettext("actions", "Edit %{container_name}", container_name: container.name)
|
||||
@ -139,7 +139,7 @@
|
||||
</.link>
|
||||
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :clone, container)}
|
||||
patch={~p"/containers/clone/#{container}"}
|
||||
class="text-primary-600 link"
|
||||
aria-label={
|
||||
dgettext("actions", "Clone %{container_name}", container_name: container.name)
|
||||
@ -173,26 +173,26 @@
|
||||
|
||||
<%= case @live_action do %>
|
||||
<% modifying when modifying in [:new, :edit, :clone] -> %>
|
||||
<.modal return_to={Routes.container_index_path(Endpoint, :index)}>
|
||||
<.modal return_to={~p"/containers"}>
|
||||
<.live_component
|
||||
module={CanneryWeb.ContainerLive.FormComponent}
|
||||
id={@container.id || :new}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
container={@container}
|
||||
return_to={Routes.container_index_path(Endpoint, :index)}
|
||||
return_to={~p"/containers"}
|
||||
current_user={@current_user}
|
||||
/>
|
||||
</.modal>
|
||||
<% :edit_tags -> %>
|
||||
<.modal return_to={Routes.container_index_path(Endpoint, :index)}>
|
||||
<.modal return_to={~p"/containers"}>
|
||||
<.live_component
|
||||
module={CanneryWeb.ContainerLive.EditTagsComponent}
|
||||
id={@container.id}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
container={@container}
|
||||
current_path={Routes.container_index_path(Endpoint, :edit_tags, @container)}
|
||||
current_path={~p"/containers/edit_tags/#{@container}"}
|
||||
current_user={@current_user}
|
||||
/>
|
||||
</.modal>
|
||||
|
@ -5,7 +5,6 @@ defmodule CanneryWeb.ContainerLive.Show do
|
||||
|
||||
use CanneryWeb, :live_view
|
||||
alias Cannery.{Accounts.User, ActivityLog, Ammo, Containers, Containers.Container}
|
||||
alias CanneryWeb.Endpoint
|
||||
alias Ecto.Changeset
|
||||
alias Phoenix.LiveView.Socket
|
||||
|
||||
@ -59,10 +58,7 @@ defmodule CanneryWeb.ContainerLive.Show do
|
||||
|> case do
|
||||
{:ok, %{name: container_name}} ->
|
||||
prompt = dgettext("prompts", "%{name} has been deleted", name: container_name)
|
||||
|
||||
socket
|
||||
|> put_flash(:info, prompt)
|
||||
|> push_navigate(to: Routes.container_index_path(socket, :index))
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: ~p"/containers")
|
||||
|
||||
{:error, %{action: :delete, errors: [packs: _error], valid?: false} = changeset} ->
|
||||
packs_error = changeset |> changeset_errors(:packs) |> Enum.join(", ")
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
<div class="flex space-x-4 justify-center items-center text-primary-600">
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :edit, @container)}
|
||||
patch={~p"/container/edit/#{@container}"}
|
||||
class="text-primary-600 link"
|
||||
aria-label={dgettext("actions", "Edit %{container_name}", container_name: @container.name)}
|
||||
>
|
||||
@ -61,10 +61,7 @@
|
||||
<%= display_emoji("😔") %>
|
||||
</h2>
|
||||
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
||||
class="btn btn-primary"
|
||||
>
|
||||
<.link patch={~p"/container/edit_tags/#{@container}"} class="btn btn-primary">
|
||||
<%= dgettext("actions", "Why not add one?") %>
|
||||
</.link>
|
||||
</div>
|
||||
@ -73,10 +70,7 @@
|
||||
<.simple_tag_card :for={tag <- @container.tags} tag={tag} />
|
||||
|
||||
<div class="mx-4 my-2">
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
||||
class="text-primary-600 link"
|
||||
>
|
||||
<.link patch={~p"/container/edit_tags/#{@container}"} class="text-primary-600 link">
|
||||
<i class="fa-fw fa-lg fas fa-tags"></i>
|
||||
</.link>
|
||||
</div>
|
||||
@ -132,7 +126,7 @@
|
||||
show_used={false}
|
||||
>
|
||||
<:type :let={%{name: type_name} = type}>
|
||||
<.link navigate={Routes.type_show_path(Endpoint, :show, type)} class="link">
|
||||
<.link navigate={~p"/type/#{type}"} class="link">
|
||||
<%= type_name %>
|
||||
</.link>
|
||||
</:type>
|
||||
@ -155,27 +149,27 @@
|
||||
|
||||
<%= case @live_action do %>
|
||||
<% :edit -> %>
|
||||
<.modal return_to={Routes.container_show_path(Endpoint, :show, @container)}>
|
||||
<.modal return_to={~p"/container/#{@container}"}>
|
||||
<.live_component
|
||||
module={CanneryWeb.ContainerLive.FormComponent}
|
||||
id={@container.id}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
container={@container}
|
||||
return_to={Routes.container_show_path(Endpoint, :show, @container)}
|
||||
return_to={~p"/container/#{@container}"}
|
||||
current_user={@current_user}
|
||||
/>
|
||||
</.modal>
|
||||
<% :edit_tags -> %>
|
||||
<.modal return_to={Routes.container_show_path(Endpoint, :show, @container)}>
|
||||
<.modal return_to={~p"/container/#{@container}"}>
|
||||
<.live_component
|
||||
module={CanneryWeb.ContainerLive.EditTagsComponent}
|
||||
id={@container.id}
|
||||
title={@page_title}
|
||||
action={@live_action}
|
||||
container={@container}
|
||||
return_to={Routes.container_show_path(Endpoint, :show, @container)}
|
||||
current_path={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
||||
return_to={~p"/container/#{@container}"}
|
||||
current_path={~p"/container/edit_tags/#{@container}"}
|
||||
current_user={@current_user}
|
||||
/>
|
||||
</.modal>
|
||||
|
Reference in New Issue
Block a user