upgrade to phoenix 1.7

This commit is contained in:
2023-04-14 23:34:11 -04:00
parent 1796fb822f
commit 1037f37be2
138 changed files with 2304 additions and 2252 deletions

View File

@ -5,7 +5,6 @@ defmodule CanneryWeb.RangeLive.Index do
use CanneryWeb, :live_view
alias Cannery.{ActivityLog, ActivityLog.ShotRecord, Ammo}
alias CanneryWeb.Endpoint
alias Phoenix.LiveView.Socket
@impl true
@ -94,11 +93,11 @@ defmodule CanneryWeb.RangeLive.Index do
end
def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.range_index_path(Endpoint, :index))}
{:noreply, socket |> push_patch(to: ~p"/range")}
end
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
{:noreply, socket |> push_patch(to: Routes.range_index_path(Endpoint, :search, search_term))}
{:noreply, socket |> push_patch(to: ~p"/range/search/#{search_term}")}
end
def handle_event("change_class", %{"type" => %{"class" => "rifle"}}, socket) do

View File

@ -9,11 +9,11 @@
<%= display_emoji("😔") %>
</h1>
<.link navigate={Routes.pack_index_path(Endpoint, :index)} class="btn btn-primary">
<.link navigate={~p"/ammo"} class="btn btn-primary">
<%= dgettext("actions", "Why not get some ready to shoot?") %>
</.link>
<% else %>
<.link navigate={Routes.pack_index_path(Endpoint, :index)} class="btn btn-primary">
<.link navigate={~p"/ammo"} class="btn btn-primary">
<%= dgettext("actions", "Stage ammo") %>
</.link>
@ -38,10 +38,7 @@
else: dgettext("actions", "Stage for range") %>
</button>
<.link
patch={Routes.range_index_path(Endpoint, :add_shot_record, pack)}
class="btn btn-primary"
>
<.link patch={~p"/range/add_shot_record/#{pack}"} class="btn btn-primary">
<%= dgettext("actions", "Record shots") %>
</.link>
</.pack_card>
@ -132,7 +129,7 @@
<:actions :let={shot_record}>
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<.link
patch={Routes.range_index_path(Endpoint, :edit, shot_record)}
patch={~p"/range/edit/#{shot_record}"}
class="text-primary-600 link"
aria-label={
dgettext("actions", "Edit shot record of %{shot_record_count} shots",
@ -168,26 +165,26 @@
<%= case @live_action do %>
<% :edit -> %>
<.modal return_to={Routes.range_index_path(Endpoint, :index)}>
<.modal return_to={~p"/range"}>
<.live_component
module={CanneryWeb.RangeLive.FormComponent}
id={@shot_record.id}
title={@page_title}
action={@live_action}
shot_record={@shot_record}
return_to={Routes.range_index_path(Endpoint, :index)}
return_to={~p"/range"}
current_user={@current_user}
/>
</.modal>
<% :add_shot_record -> %>
<.modal return_to={Routes.range_index_path(Endpoint, :index)}>
<.modal return_to={~p"/range"}>
<.live_component
module={CanneryWeb.Components.AddShotRecordComponent}
id={:new}
title={@page_title}
action={@live_action}
pack={@pack}
return_to={Routes.range_index_path(Endpoint, :index)}
return_to={~p"/range"}
current_user={@current_user}
/>
</.modal>