update to liveview 0.18 and use elixir 1.14

This commit is contained in:
2022-11-07 22:36:38 -05:00
parent 239b15a782
commit 6b565abf93
79 changed files with 2410 additions and 2321 deletions

View File

@ -53,7 +53,7 @@ defmodule CanneryWeb.RangeLive.FormComponent do
case ActivityLog.update_shot_group(shot_group, shot_group_params, current_user) do
{:ok, _shot_group} ->
prompt = dgettext("prompts", "Shot records updated successfully")
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
{:error, %Ecto.Changeset{} = changeset} ->
socket |> assign(:changeset, changeset)

View File

@ -4,7 +4,7 @@
</h2>
<.form
let={f}
:let={f}
for={@changeset}
id="shot-group-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"

View File

@ -103,10 +103,11 @@ defmodule CanneryWeb.RangeLive.Index do
case key do
:name ->
{shot_group.ammo_group.ammo_type.name,
live_patch(shot_group.ammo_group.ammo_type.name,
to: Routes.ammo_group_show_path(Endpoint, :show, shot_group.ammo_group),
class: "link"
)}
~H"""
<.link patch={Routes.ammo_group_show_path(Endpoint, :show, @shot_group.ammo_group)} class="link">
<%= @shot_group.ammo_group.ammo_type.name %>
</.link>
"""}
:date ->
date |> display_date()
@ -114,22 +115,24 @@ defmodule CanneryWeb.RangeLive.Index do
:actions ->
~H"""
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<%= live_patch to: Routes.range_index_path(Endpoint, :edit, shot_group),
class: "text-primary-600 link",
data: [qa: "edit-#{shot_group.id}"] do %>
<.link
patch={Routes.range_index_path(Endpoint, :edit, @shot_group)}
class="text-primary-600 link"
data-qa={"edit-#{@shot_group.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
</.link>
<%= link to: "#",
class: "text-primary-600 link",
phx_click: "delete",
phx_value_id: shot_group.id,
data: [
confirm: dgettext("prompts", "Are you sure you want to delete this shot record?"),
qa: "delete-#{shot_group.id}"
] do %>
<.link
href="#"
class="text-primary-600 link"
phx-click="delete"
phx-value-id={@shot_group.id}
data-confirm={dgettext("prompts", "Are you sure you want to delete this shot record?")}
data-qa={"delete-#{@shot_group.id}"}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>
</.link>
</div>
"""

View File

@ -9,15 +9,13 @@
<%= display_emoji("😔") %>
</h1>
<%= live_patch(dgettext("actions", "Why not get some ready to shoot?"),
to: Routes.ammo_group_index_path(Endpoint, :index),
class: "btn btn-primary"
) %>
<.link patch={Routes.ammo_group_index_path(Endpoint, :index)} class="btn btn-primary">
<%= dgettext("actions", "Why not get some ready to shoot?") %>
</.link>
<% else %>
<%= live_patch(dgettext("actions", "Stage ammo"),
to: Routes.ammo_group_index_path(Endpoint, :index),
class: "btn btn-primary"
) %>
<.link patch={Routes.ammo_group_index_path(Endpoint, :index)} class="btn btn-primary">
<%= dgettext("actions", "Stage ammo") %>
</.link>
<%= for ammo_group <- @ammo_groups do %>
<.ammo_group_card ammo_group={ammo_group}>
@ -33,10 +31,12 @@
else: gettext("Stage for range") %>
</button>
<%= live_patch(dgettext("actions", "Record shots"),
to: Routes.range_index_path(Endpoint, :add_shot_group, ammo_group),
class: "btn btn-primary"
) %>
<.link
patch={Routes.range_index_path(Endpoint, :add_shot_group, ammo_group)}
class="btn btn-primary"
>
<%= dgettext("actions", "Record shots") %>
</.link>
</.ammo_group_card>
<% end %>
<% end %>