update to liveview 0.18 and use elixir 1.14
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
239b15a782
commit
6b565abf93
@ -16,7 +16,7 @@ steps:
|
||||
- assets/node_modules/
|
||||
|
||||
- name: test
|
||||
image: elixir:1.13.4-alpine
|
||||
image: elixir:1.14.1-alpine
|
||||
environment:
|
||||
TEST_DATABASE_URL: ecto://postgres:postgres@database/cannery_test
|
||||
HOST: testing.example.tld
|
||||
|
@ -1,3 +1,3 @@
|
||||
elixir 1.13.4-otp-24
|
||||
erlang 24.2
|
||||
elixir 1.14.1-otp-25
|
||||
erlang 25.1.2
|
||||
nodejs 16.13.2
|
||||
|
@ -10,6 +10,7 @@
|
||||
- Make container show page a bit more compact
|
||||
- Make container show page filter used-up ammo
|
||||
- Forgot to add the logo as the favicon whoops
|
||||
- Update project dependencies, use Elixir v1.14.1
|
||||
|
||||
# v0.5.4
|
||||
- Rename "Ammo" tab to "Catalog", and "Manage" tab is now "Ammo"
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM elixir:1.13.4-alpine AS build
|
||||
FROM elixir:1.14.1-alpine AS build
|
||||
|
||||
# install build dependencies
|
||||
RUN apk add --no-cache build-base npm git python3
|
||||
|
@ -96,7 +96,7 @@ defmodule CanneryWeb do
|
||||
|
||||
# Import LiveView and .heex helpers (live_render, live_patch, <.form>, etc)
|
||||
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
|
||||
import Phoenix.LiveView.Helpers
|
||||
import Phoenix.Component
|
||||
|
||||
# Import basic rendering functionality (render, render_layout, etc)
|
||||
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
|
||||
|
@ -54,7 +54,7 @@ defmodule CanneryWeb.Components.AddShotGroupComponent do
|
||||
|> case do
|
||||
{:ok, _shot_group} ->
|
||||
prompt = dgettext("prompts", "Shots recorded 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)
|
||||
|
@ -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"
|
||||
|
@ -22,12 +22,11 @@ defmodule CanneryWeb.Components.AmmoGroupCard do
|
||||
border border-gray-400 rounded-lg shadow-lg hover:shadow-md
|
||||
transition-all duration-300 ease-in-out"
|
||||
>
|
||||
<%= live_patch to: Routes.ammo_group_show_path(Endpoint, :show, @ammo_group),
|
||||
class: "mb-2 link" do %>
|
||||
<.link patch={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)} class="mb-2 link">
|
||||
<h1 class="title text-xl title-primary-500">
|
||||
<%= @ammo_group.ammo_type.name %>
|
||||
</h1>
|
||||
<% end %>
|
||||
</.link>
|
||||
|
||||
<div class="flex flex-col justify-center items-center">
|
||||
<span class="rounded-lg title text-lg">
|
||||
@ -67,10 +66,12 @@ defmodule CanneryWeb.Components.AmmoGroupCard do
|
||||
<span class="rounded-lg title text-lg">
|
||||
<%= gettext("Container:") %>
|
||||
|
||||
<%= live_patch to: Routes.container_show_path(Endpoint, :show, @ammo_group.container),
|
||||
class: "link" do %>
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :show, @ammo_group.container)}
|
||||
class="link"
|
||||
>
|
||||
<%= @ammo_group.container.name %>
|
||||
<% end %>
|
||||
</.link>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -19,12 +19,11 @@ defmodule CanneryWeb.Components.ContainerCard do
|
||||
transition-all duration-300 ease-in-out"
|
||||
>
|
||||
<div class="max-w-full mb-4 flex flex-col justify-center items-center space-y-2">
|
||||
<%= live_redirect to: Routes.container_show_path(Endpoint, :show, @container),
|
||||
class: "link" do %>
|
||||
<.link navigate={Routes.container_show_path(Endpoint, :show, @container)} class="link">
|
||||
<h1 class="px-4 py-2 rounded-lg title text-xl">
|
||||
<%= @container.name %>
|
||||
</h1>
|
||||
<% end %>
|
||||
</.link>
|
||||
|
||||
<%= if @container.desc do %>
|
||||
<span class="rounded-lg title text-lg">
|
||||
|
@ -52,7 +52,7 @@ defmodule CanneryWeb.Components.MoveAmmoGroupComponent do
|
||||
{:ok, _ammo_group} ->
|
||||
prompt = dgettext("prompts", "Ammo moved to %{name} successfully", name: container_name)
|
||||
|
||||
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)
|
||||
@ -86,10 +86,9 @@ defmodule CanneryWeb.Components.MoveAmmoGroupComponent do
|
||||
<%= display_emoji("😔") %>
|
||||
</h2>
|
||||
|
||||
<%= live_patch(dgettext("actions", "Add another container!"),
|
||||
to: Routes.container_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "Add another container!") %>
|
||||
</.link>
|
||||
<% else %>
|
||||
<.live_component
|
||||
module={CanneryWeb.Components.TableComponent}
|
||||
@ -122,7 +121,7 @@ defmodule CanneryWeb.Components.MoveAmmoGroupComponent do
|
||||
class="btn btn-primary"
|
||||
phx-click="move"
|
||||
phx-target={@myself}
|
||||
phx-value-container_id={container.id}
|
||||
phx-value-container_id={@container.id}
|
||||
>
|
||||
<%= dgettext("actions", "Select") %>
|
||||
</button>
|
||||
|
@ -16,16 +16,17 @@ defmodule CanneryWeb.Components.Topbar do
|
||||
<nav role="navigation" class="mb-8 px-8 py-4 w-full bg-primary-400">
|
||||
<div class="flex flex-col sm:flex-row justify-between items-center">
|
||||
<div class="mb-4 sm:mb-0 sm:mr-8 flex flex-row justify-start items-center space-x-2">
|
||||
<%= live_redirect to: Routes.live_path(Endpoint, HomeLive),
|
||||
class: "inline mx-2 my-1 leading-5 text-xl text-white"
|
||||
do %>
|
||||
<.link
|
||||
patch={Routes.live_path(Endpoint, HomeLive)}
|
||||
class="inline mx-2 my-1 leading-5 text-xl text-white"
|
||||
>
|
||||
<img
|
||||
src={Routes.static_path(Endpoint, "/images/cannery.svg")}
|
||||
alt={gettext("Cannery logo")}
|
||||
class="inline-block h-8 mx-1"
|
||||
/>
|
||||
<h1 class="inline hover:underline">Cannery</h1>
|
||||
<% end %>
|
||||
</.link>
|
||||
|
||||
<%= if @title_content do %>
|
||||
<span class="mx-2 my-1">
|
||||
@ -41,78 +42,100 @@ defmodule CanneryWeb.Components.Topbar do
|
||||
text-lg text-white text-ellipsis">
|
||||
<%= if @current_user do %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= live_redirect(gettext("Tags"),
|
||||
to: Routes.tag_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.tag_index_path(Endpoint, :index)}
|
||||
class="text-primary-600 text-white hover:underline"
|
||||
>
|
||||
<%= gettext("Tags") %>
|
||||
</.link>
|
||||
</li>
|
||||
<li class="mx-2 my-1">
|
||||
<%= live_redirect(gettext("Containers"),
|
||||
to: Routes.container_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :index)}
|
||||
class="text-primary-600 text-white hover:underline"
|
||||
>
|
||||
<%= gettext("Containers") %>
|
||||
</.link>
|
||||
</li>
|
||||
<li class="mx-2 my-1">
|
||||
<%= live_redirect(gettext("Catalog"),
|
||||
to: Routes.ammo_type_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.ammo_type_index_path(Endpoint, :index)}
|
||||
class="text-primary-600 text-white hover:underline"
|
||||
>
|
||||
<%= gettext("Catalog") %>
|
||||
</.link>
|
||||
</li>
|
||||
<li class="mx-2 my-1">
|
||||
<%= live_redirect(gettext("Ammo"),
|
||||
to: Routes.ammo_group_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.ammo_group_index_path(Endpoint, :index)}
|
||||
class="text-primary-600 text-white hover:underline"
|
||||
>
|
||||
<%= gettext("Ammo") %>
|
||||
</.link>
|
||||
</li>
|
||||
<li class="mx-2 my-1">
|
||||
<%= live_redirect(gettext("Range"),
|
||||
to: Routes.range_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.range_index_path(Endpoint, :index)}
|
||||
class="text-primary-600 text-white hover:underline"
|
||||
>
|
||||
<%= gettext("Range") %>
|
||||
</.link>
|
||||
</li>
|
||||
<%= if @current_user.role == :admin do %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= live_redirect(gettext("Invites"),
|
||||
to: Routes.invite_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.invite_index_path(Endpoint, :index)}
|
||||
class="text-primary-600 text-white hover:underline"
|
||||
>
|
||||
<%= gettext("Invites") %>
|
||||
</.link>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= live_redirect(@current_user.email,
|
||||
to: Routes.user_settings_path(Endpoint, :edit),
|
||||
class: "text-primary-600 text-white hover:underline truncate"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.user_settings_path(Endpoint, :edit)}
|
||||
class="text-primary-600 text-white hover:underline truncate"
|
||||
>
|
||||
<%= @current_user.email %>
|
||||
</.link>
|
||||
</li>
|
||||
<li class="mx-2 my-1">
|
||||
<%= link to: Routes.user_session_path(Endpoint, :delete),
|
||||
method: :delete,
|
||||
data: [confirm: dgettext("prompts", "Are you sure you want to log out?")] do %>
|
||||
<.link
|
||||
href={Routes.user_session_path(Endpoint, :delete)}
|
||||
method="delete"
|
||||
data-confirm={dgettext("prompts", "Are you sure you want to log out?")}
|
||||
>
|
||||
<i class="fas fa-sign-out-alt"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</li>
|
||||
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= live_redirect to: Routes.live_dashboard_path(Endpoint, :home),
|
||||
class: "text-primary-600 text-white hover:underline" do %>
|
||||
<.link
|
||||
patch={Routes.live_dashboard_path(Endpoint, :home)}
|
||||
class="text-primary-600 text-white hover:underline"
|
||||
>
|
||||
<i class="fas fa-gauge"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= if Accounts.allow_registration?() do %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= live_redirect(dgettext("actions", "Register"),
|
||||
to: Routes.user_registration_path(Endpoint, :new),
|
||||
class: "text-primary-600 text-white hover:underline truncate"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.user_registration_path(Endpoint, :new)}
|
||||
class="text-primary-600 text-white hover:underline truncate"
|
||||
>
|
||||
<%= dgettext("actions", "Register") %>
|
||||
</.link>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= live_redirect(dgettext("actions", "Log in"),
|
||||
to: Routes.user_session_path(Endpoint, :new),
|
||||
class: "text-primary-600 text-white hover:underline truncate"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.user_session_path(Endpoint, :new)}
|
||||
class="text-primary-600 text-white hover:underline truncate"
|
||||
>
|
||||
<%= dgettext("actions", "Log in") %>
|
||||
</.link>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
@ -116,7 +116,7 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
|
||||
case Ammo.update_ammo_group(ammo_group, ammo_group_params, current_user) do
|
||||
{:ok, _ammo_group} ->
|
||||
prompt = dgettext("prompts", "Ammo updated successfully")
|
||||
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
socket |> assign(:changeset, changeset)
|
||||
@ -181,7 +181,7 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
|
||||
count
|
||||
)
|
||||
|
||||
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
socket |> assign(changeset: changeset)
|
||||
|
@ -4,7 +4,7 @@
|
||||
</h2>
|
||||
|
||||
<.form
|
||||
let={f}
|
||||
:let={f}
|
||||
for={@changeset}
|
||||
id="ammo_group-form"
|
||||
phx-target={@myself}
|
||||
|
@ -129,11 +129,14 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
|
||||
|
||||
@spec get_value_for_key(atom(), AmmoGroup.t()) :: any()
|
||||
defp get_value_for_key(:ammo_type, %{ammo_type: ammo_type}) do
|
||||
assigns = %{ammo_type: ammo_type}
|
||||
|
||||
{ammo_type.name,
|
||||
live_patch(ammo_type.name,
|
||||
to: Routes.ammo_type_show_path(Endpoint, :show, ammo_type),
|
||||
class: "link"
|
||||
)}
|
||||
~H"""
|
||||
<.link patch={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)} class="link">
|
||||
<%= @ammo_type.name %>
|
||||
</.link>
|
||||
"""}
|
||||
end
|
||||
|
||||
defp get_value_for_key(:price_paid, %{price_paid: nil}), do: {"a", nil}
|
||||
@ -175,15 +178,17 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
|
||||
type="button"
|
||||
class="mx-2 my-1 text-sm btn btn-primary"
|
||||
phx-click="toggle_staged"
|
||||
phx-value-ammo_group_id={ammo_group.id}
|
||||
phx-value-ammo_group_id={@ammo_group.id}
|
||||
>
|
||||
<%= if ammo_group.staged, do: gettext("Unstage"), else: gettext("Stage") %>
|
||||
<%= if @ammo_group.staged, do: gettext("Unstage"), else: gettext("Stage") %>
|
||||
</button>
|
||||
|
||||
<%= live_patch(dgettext("actions", "Record shots"),
|
||||
to: Routes.ammo_group_index_path(Endpoint, :add_shot_group, ammo_group),
|
||||
class: "mx-2 my-1 text-sm btn btn-primary"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.ammo_group_index_path(Endpoint, :add_shot_group, @ammo_group)}
|
||||
class="mx-2 my-1 text-sm btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "Record shots") %>
|
||||
</.link>
|
||||
</div>
|
||||
"""}
|
||||
end
|
||||
@ -196,28 +201,32 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
|
||||
|
||||
~H"""
|
||||
<div class="py-2 px-4 h-full space-x-4 flex justify-center items-center">
|
||||
<%= live_redirect to: Routes.ammo_group_show_path(Endpoint, :show, ammo_group),
|
||||
class: "text-primary-600 link",
|
||||
data: [qa: "view-#{ammo_group.id}"] do %>
|
||||
<.link
|
||||
patch={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)}
|
||||
class="text-primary-600 link"
|
||||
data-qa={"view-#{@ammo_group.id}"}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-eye"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
|
||||
<%= live_patch to: Routes.ammo_group_index_path(Endpoint, :edit, ammo_group),
|
||||
class: "text-primary-600 link",
|
||||
data: [qa: "edit-#{ammo_group.id}"] do %>
|
||||
<.link
|
||||
patch={Routes.ammo_group_index_path(Endpoint, :edit, @ammo_group)}
|
||||
class="text-primary-600 link"
|
||||
data-qa={"edit-#{@ammo_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: ammo_group.id,
|
||||
data: [
|
||||
confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"),
|
||||
qa: "delete-#{ammo_group.id}"
|
||||
] do %>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-600 link"
|
||||
phx-click="delete"
|
||||
phx-value-id={@ammo_group.id}
|
||||
data-confirm={dgettext("prompts", "Are you sure you want to delete this ammo?")}
|
||||
data-qa={"delete-#{@ammo_group.id}"}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
@ -230,17 +239,19 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
|
||||
{container_name,
|
||||
~H"""
|
||||
<div class="min-w-20 py-2 px-4 h-full flex flew-wrap justify-center items-center">
|
||||
<%= live_patch(
|
||||
@ammo_group.container.name,
|
||||
to: Routes.container_show_path(Endpoint, :show, @ammo_group.container),
|
||||
class: "mx-2 my-1 link"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :show, @ammo_group.container)}
|
||||
class="mx-2 my-1 link"
|
||||
>
|
||||
<%= @ammo_group.container.name %>
|
||||
</.link>
|
||||
|
||||
<%= live_patch(
|
||||
gettext("Move ammo"),
|
||||
to: Routes.ammo_group_index_path(Endpoint, :move, @ammo_group),
|
||||
class: "mx-2 my-1 text-sm btn btn-primary"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.ammo_group_index_path(Endpoint, :move, @ammo_group)}
|
||||
class="mx-2 my-1 text-sm btn btn-primary"
|
||||
>
|
||||
<%= gettext("Move ammo") %>
|
||||
</.link>
|
||||
</div>
|
||||
"""}
|
||||
end
|
||||
|
@ -17,10 +17,9 @@
|
||||
<%= dgettext("prompts", "You'll need to") %>
|
||||
</h2>
|
||||
|
||||
<%= live_patch(dgettext("actions", "add a container first"),
|
||||
to: Routes.container_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "add a container first") %>
|
||||
</.link>
|
||||
</div>
|
||||
<% @ammo_types_count == 0 -> %>
|
||||
<div class="flex justify-center items-center">
|
||||
@ -28,21 +27,18 @@
|
||||
<%= dgettext("prompts", "You'll need to") %>
|
||||
</h2>
|
||||
|
||||
<%= live_patch(dgettext("actions", "add an ammo type first"),
|
||||
to: Routes.ammo_type_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "add an ammo type first") %>
|
||||
</.link>
|
||||
</div>
|
||||
<% @ammo_groups |> Enum.empty?() -> %>
|
||||
<%= live_patch(dgettext("actions", "Add your first box!"),
|
||||
to: Routes.ammo_group_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.ammo_group_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "Add your first box!") %>
|
||||
</.link>
|
||||
<% true -> %>
|
||||
<%= live_patch(dgettext("actions", "Add Ammo"),
|
||||
to: Routes.ammo_group_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.ammo_group_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "Add Ammo") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
|
||||
<%= unless @ammo_groups |> Enum.empty?() do %>
|
||||
|
@ -50,7 +50,7 @@ defmodule CanneryWeb.AmmoGroupLive.Show do
|
||||
prompt = dgettext("prompts", "Ammo deleted succesfully")
|
||||
redirect_to = Routes.ammo_group_index_path(socket, :index)
|
||||
|
||||
{:noreply, socket |> put_flash(:info, prompt) |> push_redirect(to: redirect_to)}
|
||||
{:noreply, socket |> put_flash(:info, prompt) |> push_navigate(to: redirect_to)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
@ -116,22 +116,24 @@ defmodule CanneryWeb.AmmoGroupLive.Show do
|
||||
:actions ->
|
||||
~H"""
|
||||
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
|
||||
<%= live_patch to: Routes.ammo_group_show_path(Endpoint, :edit_shot_group, @ammo_group, shot_group),
|
||||
class: "text-primary-600 link",
|
||||
data: [qa: "edit-#{shot_group.id}"] do %>
|
||||
<.link
|
||||
patch={Routes.ammo_group_show_path(Endpoint, :edit_shot_group, @ammo_group, @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_shot_group",
|
||||
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_shot_group"
|
||||
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>
|
||||
"""
|
||||
|
||||
|
@ -52,27 +52,31 @@
|
||||
|
||||
<div class="flex flex-col justify-center items-center">
|
||||
<div class="flex flex-wrap justify-center items-center text-primary-600">
|
||||
<%= live_patch(dgettext("actions", "View in Catalog"),
|
||||
to: Routes.ammo_type_show_path(Endpoint, :show, @ammo_group.ammo_type),
|
||||
class: "mx-4 my-2 btn btn-primary",
|
||||
data: [qa: "details"]
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.ammo_type_show_path(Endpoint, :show, @ammo_group.ammo_type)}
|
||||
class="mx-4 my-2 btn btn-primary"
|
||||
data-qa="details"
|
||||
>
|
||||
<%= dgettext("actions", "View in Catalog") %>
|
||||
</.link>
|
||||
|
||||
<%= live_patch to: Routes.ammo_group_show_path(Endpoint, :edit, @ammo_group),
|
||||
class: "mx-4 my-2 text-primary-600 link",
|
||||
data: [qa: "edit"] do %>
|
||||
<.link
|
||||
patch={Routes.ammo_group_show_path(Endpoint, :edit, @ammo_group)}
|
||||
class="mx-4 my-2 text-primary-600 link"
|
||||
data-qa="edit"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-edit"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
|
||||
<%= link to: "#",
|
||||
class: "mx-4 my-2 text-primary-600 link",
|
||||
phx_click: "delete",
|
||||
data: [
|
||||
confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"),
|
||||
qa: "delete"
|
||||
] do %>
|
||||
<.link
|
||||
href="#"
|
||||
class="mx-4 my-2 text-primary-600 link"
|
||||
phx-click="delete"
|
||||
data-confirm={dgettext("prompts", "Are you sure you want to delete this ammo?")}
|
||||
data-qa="delete"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap justify-center items-center text-primary-600">
|
||||
@ -82,16 +86,20 @@
|
||||
else: gettext("Stage for range") %>
|
||||
</button>
|
||||
|
||||
<%= live_patch(dgettext("actions", "Move containers"),
|
||||
to: Routes.ammo_group_show_path(Endpoint, :move, @ammo_group),
|
||||
class: "btn btn-primary",
|
||||
data: [qa: "move"]
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.ammo_group_show_path(Endpoint, :move, @ammo_group)}
|
||||
class="btn btn-primary"
|
||||
data-qa="move"
|
||||
>
|
||||
<%= dgettext("actions", "Move containers") %>
|
||||
</.link>
|
||||
|
||||
<%= live_patch(dgettext("actions", "Record shots"),
|
||||
to: Routes.ammo_group_show_path(Endpoint, :add_shot_group, @ammo_group),
|
||||
class: "mx-4 my-2 btn btn-primary"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.ammo_group_show_path(Endpoint, :add_shot_group, @ammo_group)}
|
||||
class="mx-4 my-2 btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "Record shots") %>
|
||||
</.link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -65,7 +65,7 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
|
||||
case Ammo.update_ammo_type(ammo_type, ammo_type_params, current_user) do
|
||||
{:ok, %{name: ammo_type_name}} ->
|
||||
prompt = dgettext("prompts", "%{name} updated successfully", name: ammo_type_name)
|
||||
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
socket |> assign(:changeset, changeset)
|
||||
@ -83,7 +83,7 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
|
||||
case Ammo.create_ammo_type(ammo_type_params, current_user) do
|
||||
{:ok, %{name: ammo_type_name}} ->
|
||||
prompt = dgettext("prompts", "%{name} created successfully", name: ammo_type_name)
|
||||
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
socket |> assign(changeset: changeset)
|
||||
|
@ -3,7 +3,7 @@
|
||||
<%= @title %>
|
||||
</h2>
|
||||
<.form
|
||||
let={f}
|
||||
:let={f}
|
||||
for={@changeset}
|
||||
id="ammo_type-form"
|
||||
phx-target={@myself}
|
||||
|
@ -123,11 +123,13 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
|
||||
assigns = %{ammo_type: ammo_type}
|
||||
|
||||
~H"""
|
||||
<%= live_redirect to: Routes.ammo_type_show_path(Endpoint, :show, ammo_type),
|
||||
class: "link",
|
||||
data: [qa: "view-name-#{ammo_type.id}"] do %>
|
||||
<%= ammo_type.name %>
|
||||
<% end %>
|
||||
<.link
|
||||
patch={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)}
|
||||
class="link"
|
||||
data-qa={"view-name-#{@ammo_type.id}"}
|
||||
>
|
||||
<%= @ammo_type.name %>
|
||||
</.link>
|
||||
"""
|
||||
end
|
||||
|
||||
@ -136,28 +138,38 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
|
||||
|
||||
~H"""
|
||||
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
|
||||
<%= live_redirect to: Routes.ammo_type_show_path(Endpoint, :show, ammo_type),
|
||||
class: "text-primary-600 link",
|
||||
data: [qa: "view-#{ammo_type.id}"] do %>
|
||||
<.link
|
||||
patch={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)}
|
||||
class="text-primary-600 link"
|
||||
data-qa={"view-#{@ammo_type.id}"}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-eye"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
|
||||
<%= live_patch to: Routes.ammo_type_index_path(Endpoint, :edit, ammo_type),
|
||||
class: "text-primary-600 link",
|
||||
data: [qa: "edit-#{ammo_type.id}"] do %>
|
||||
<.link
|
||||
patch={Routes.ammo_type_index_path(Endpoint, :edit, @ammo_type)}
|
||||
class="text-primary-600 link"
|
||||
data-qa={"edit-#{@ammo_type.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: ammo_type.id,
|
||||
data: [
|
||||
confirm: dgettext("prompts", "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!", name: ammo_type.name),
|
||||
qa: "delete-#{ammo_type.id}"
|
||||
] do %>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-600 link"
|
||||
phx-click="delete"
|
||||
phx-value-id={@ammo_type.id}
|
||||
data-confirm={
|
||||
dgettext(
|
||||
"prompts",
|
||||
"Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!",
|
||||
name: @ammo_type.name
|
||||
)
|
||||
}
|
||||
data-qa={"delete-#{@ammo_type.id}"}
|
||||
>
|
||||
<i class="fa-lg fas fa-trash"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
@ -9,15 +9,13 @@
|
||||
<%= display_emoji("😔") %>
|
||||
</h2>
|
||||
|
||||
<%= live_patch(dgettext("actions", "Add your first type!"),
|
||||
to: Routes.ammo_type_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "Add your first type!") %>
|
||||
</.link>
|
||||
<% else %>
|
||||
<%= live_patch(dgettext("actions", "New Ammo type"),
|
||||
to: Routes.ammo_type_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "New Ammo type") %>
|
||||
</.link>
|
||||
|
||||
<.live_component
|
||||
module={CanneryWeb.Components.TableComponent}
|
||||
|
@ -28,7 +28,7 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
|
||||
prompt = dgettext("prompts", "%{name} deleted succesfully", name: ammo_type_name)
|
||||
redirect_to = Routes.ammo_type_index_path(socket, :index)
|
||||
|
||||
{:noreply, socket |> put_flash(:info, prompt) |> push_redirect(to: redirect_to)}
|
||||
{:noreply, socket |> put_flash(:info, prompt) |> push_navigate(to: redirect_to)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
@ -12,22 +12,29 @@
|
||||
<% end %>
|
||||
|
||||
<div class="flex space-x-4 justify-center items-center text-primary-600">
|
||||
<%= live_patch to: Routes.ammo_type_show_path(Endpoint, :edit, @ammo_type),
|
||||
class: "text-primary-600 link",
|
||||
data: [qa: "edit"] do %>
|
||||
<.link
|
||||
patch={Routes.ammo_type_show_path(Endpoint, :edit, @ammo_type)}
|
||||
class="text-primary-600 link"
|
||||
data-qa="edit"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-edit"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
|
||||
<%= link to: "#",
|
||||
class: "text-primary-600 link",
|
||||
phx_click: "delete",
|
||||
data: [
|
||||
confirm:
|
||||
dgettext("prompts", "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!", name: @ammo_type.name),
|
||||
qa: "delete"
|
||||
] do %>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-600 link"
|
||||
phx-click="delete"
|
||||
data-confirm={
|
||||
dgettext(
|
||||
"prompts",
|
||||
"Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!",
|
||||
name: @ammo_type.name
|
||||
)
|
||||
}
|
||||
data-qa="delete"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<hr class="hr" />
|
||||
|
@ -5,24 +5,25 @@
|
||||
|
||||
<div class="flex flex-wrap justify-center items-center">
|
||||
<%= for tag <- @container.tags do %>
|
||||
<%= link to: "#",
|
||||
class: "mx-2 my-1 px-4 py-2 rounded-lg title text-xl",
|
||||
style: "color: #{tag.text_color}; background-color: #{tag.bg_color}",
|
||||
phx_click: "delete",
|
||||
phx_value_tag_id: tag.id,
|
||||
phx_target: @myself,
|
||||
data: [
|
||||
confirm:
|
||||
dgettext(
|
||||
"prompts",
|
||||
"Are you sure you want to remove the %{tag_name} tag from %{container_name}?",
|
||||
tag_name: tag.name,
|
||||
container_name: @container.name
|
||||
)
|
||||
] do %>
|
||||
<.link
|
||||
href="#"
|
||||
class="mx-2 my-1 px-4 py-2 rounded-lg title text-xl"
|
||||
style={"color: #{tag.text_color}; background-color: #{tag.bg_color}"}
|
||||
phx-click="delete"
|
||||
phx-value-tag-id={tag.id}
|
||||
phx-target={@myself}
|
||||
data-confirm={
|
||||
dgettext(
|
||||
"prompts",
|
||||
"Are you sure you want to remove the %{tag_name} tag from %{container_name}?",
|
||||
tag_name: tag.name,
|
||||
container_name: @container.name
|
||||
)
|
||||
}
|
||||
>
|
||||
<%= tag.name %>
|
||||
<i class="fa-fw fa-sm fas fa-trash"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
<% end %>
|
||||
|
||||
<%= if @container.tags |> Enum.empty?() do %>
|
||||
@ -37,7 +38,7 @@
|
||||
<hr class="hr" />
|
||||
|
||||
<.form
|
||||
let={f}
|
||||
:let={f}
|
||||
for={:tag}
|
||||
id="add-tag-to-container-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"
|
||||
|
@ -65,7 +65,7 @@ defmodule CanneryWeb.ContainerLive.FormComponent do
|
||||
case Containers.update_container(container, current_user, container_params) do
|
||||
{:ok, %{name: container_name}} ->
|
||||
prompt = dgettext("prompts", "%{name} updated successfully", name: container_name)
|
||||
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
socket |> assign(:changeset, changeset)
|
||||
@ -83,7 +83,7 @@ defmodule CanneryWeb.ContainerLive.FormComponent do
|
||||
case Containers.create_container(container_params, current_user) do
|
||||
{:ok, %{name: container_name}} ->
|
||||
prompt = dgettext("prompts", "%{name} created successfully", name: container_name)
|
||||
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
socket |> assign(changeset: changeset)
|
||||
|
@ -3,7 +3,7 @@
|
||||
<%= @title %>
|
||||
</h2>
|
||||
<.form
|
||||
let={f}
|
||||
:let={f}
|
||||
for={@changeset}
|
||||
id="container-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"
|
||||
|
@ -9,15 +9,13 @@
|
||||
<%= display_emoji("😔") %>
|
||||
</h2>
|
||||
|
||||
<%= live_patch(dgettext("actions", "Add your first container!"),
|
||||
to: Routes.container_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "Add your first container!") %>
|
||||
</.link>
|
||||
<% else %>
|
||||
<%= live_patch(dgettext("actions", "New Container"),
|
||||
to: Routes.container_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "New Container") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
|
||||
<div class="max-w-full flex flex-row flex-wrap justify-center items-center">
|
||||
@ -25,29 +23,34 @@
|
||||
<.container_card container={container}>
|
||||
<:tag_actions>
|
||||
<div class="mx-4 my-2">
|
||||
<%= live_patch to: Routes.container_index_path(Endpoint, :edit_tags, container),
|
||||
class: "text-primary-600 link" do %>
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
|
||||
class="text-primary-600 link"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-tags"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</div>
|
||||
</:tag_actions>
|
||||
<%= live_patch to: Routes.container_index_path(Endpoint, :edit, container),
|
||||
class: "text-primary-600 link",
|
||||
data: [qa: "edit-#{container.id}"] do %>
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :edit, container)}
|
||||
class="text-primary-600 link"
|
||||
data-qa={"edit-#{container.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: container.id,
|
||||
data: [
|
||||
confirm:
|
||||
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name),
|
||||
qa: "delete-#{container.id}"
|
||||
] do %>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-600 link"
|
||||
phx-click="delete"
|
||||
phx-value-id={container.id}
|
||||
data-confirm={
|
||||
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name)
|
||||
}
|
||||
data-qa={"delete-#{container.id}"}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</.container_card>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -62,7 +62,7 @@ defmodule CanneryWeb.ContainerLive.Show do
|
||||
|
||||
socket
|
||||
|> put_flash(:info, prompt)
|
||||
|> push_redirect(to: Routes.container_index_path(socket, :index))
|
||||
|> push_navigate(to: Routes.container_index_path(socket, :index))
|
||||
|
||||
{:error, %{action: :delete, errors: [ammo_groups: _error], valid?: false} = changeset} ->
|
||||
ammo_groups_error = changeset |> changeset_errors(:ammo_groups) |> Enum.join(", ")
|
||||
|
@ -35,22 +35,25 @@
|
||||
<% end %>
|
||||
|
||||
<div class="flex space-x-4 justify-center items-center text-primary-600">
|
||||
<%= live_patch to: Routes.container_show_path(Endpoint, :edit, @container),
|
||||
class: "text-primary-600 link",
|
||||
data: [qa: "edit"] do %>
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :edit, @container)}
|
||||
class="text-primary-600 link"
|
||||
data-qa="edit"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-edit"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
|
||||
<%= link to: "#",
|
||||
class: "text-primary-600 link",
|
||||
phx_click: "delete_container",
|
||||
data: [
|
||||
confirm:
|
||||
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name),
|
||||
qa: "delete"
|
||||
] do %>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-600 link"
|
||||
phx-click="delete_container"
|
||||
data-confirm={
|
||||
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name)
|
||||
}
|
||||
data-qa="delete"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<hr class="mb-4 hr" />
|
||||
@ -62,10 +65,12 @@
|
||||
<%= display_emoji("😔") %>
|
||||
</h2>
|
||||
|
||||
<%= live_patch(dgettext("actions", "Why not add one?"),
|
||||
to: Routes.container_show_path(Endpoint, :edit_tags, @container),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
||||
class="btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "Why not add one?") %>
|
||||
</.link>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="flex flex-wrap justify-center items-center">
|
||||
@ -74,10 +79,12 @@
|
||||
<% end %>
|
||||
|
||||
<div class="mx-4 my-2">
|
||||
<%= live_patch to: Routes.container_show_path(Endpoint, :edit_tags, @container),
|
||||
class: "text-primary-600 link" do %>
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
||||
class="text-primary-600 link"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-tags"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -101,10 +101,12 @@ defmodule CanneryWeb.HomeLive do
|
||||
</b>
|
||||
<p>
|
||||
<%= if @admins |> Enum.empty?() do %>
|
||||
<%= link(dgettext("prompts", "Register to setup %{name}", name: "Cannery"),
|
||||
class: "hover:underline",
|
||||
to: Routes.user_registration_path(CanneryWeb.Endpoint, :new)
|
||||
) %>
|
||||
<.link
|
||||
href={Routes.user_registration_path(CanneryWeb.Endpoint, :new)}
|
||||
class="hover:underline"
|
||||
>
|
||||
<%= dgettext("prompts", "Register to setup %{name}", name: "Cannery") %>
|
||||
</.link>
|
||||
<% else %>
|
||||
<div class="flex flex-wrap justify-center space-x-2">
|
||||
<%= for admin <- @admins do %>
|
||||
@ -130,13 +132,15 @@ defmodule CanneryWeb.HomeLive do
|
||||
|
||||
<li class="flex flex-row justify-center items-center space-x-2">
|
||||
<b>Version:</b>
|
||||
<%= link class: "flex flex-row justify-center items-center space-x-2 hover:underline",
|
||||
to: "https://gitea.bubbletea.dev/shibao/cannery/src/branch/stable/CHANGELOG.md",
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer" do %>
|
||||
<.link
|
||||
href="https://gitea.bubbletea.dev/shibao/cannery/src/branch/stable/CHANGELOG.md"
|
||||
class="flex flex-row justify-center items-center space-x-2 hover:underline"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<p>0.5.5</p>
|
||||
<i class="fas fa-md fa-info-circle"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -148,31 +152,37 @@ defmodule CanneryWeb.HomeLive do
|
||||
</h2>
|
||||
|
||||
<li class="flex flex-col justify-center space-x-2">
|
||||
<%= link class: "flex flex-row justify-center items-center space-x-2 hover:underline",
|
||||
to: "https://gitea.bubbletea.dev/shibao/cannery",
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer" do %>
|
||||
<.link
|
||||
class="flex flex-row justify-center items-center space-x-2 hover:underline"
|
||||
href="https://gitea.bubbletea.dev/shibao/cannery"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<p><%= gettext("View the source code") %></p>
|
||||
<i class="fas fa-md fa-code"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</li>
|
||||
<li class="flex flex-col justify-center space-x-2">
|
||||
<%= link class: "flex flex-row justify-center items-center space-x-2 hover:underline",
|
||||
to: "https://weblate.bubbletea.dev/engage/cannery",
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer" do %>
|
||||
<.link
|
||||
class="flex flex-row justify-center items-center space-x-2 hover:underline"
|
||||
href="https://weblate.bubbletea.dev/engage/cannery"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<p><%= gettext("Help translate") %></p>
|
||||
<i class="fas fa-md fa-language"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</li>
|
||||
<li class="flex flex-col justify-center space-x-2">
|
||||
<%= link class: "flex flex-row justify-center items-center space-x-2 hover:underline",
|
||||
to: "https://gitea.bubbletea.dev/shibao/cannery/issues/new",
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer" do %>
|
||||
<.link
|
||||
class="flex flex-row justify-center items-center space-x-2 hover:underline"
|
||||
href="https://gitea.bubbletea.dev/shibao/cannery/issues/new"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<p><%= gettext("Report bugs or request features") %></p>
|
||||
<i class="fas fa-md fa-spider"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -2,7 +2,7 @@ defmodule CanneryWeb.InitAssigns do
|
||||
@moduledoc """
|
||||
Ensures common `assigns` are applied to all LiveViews attaching this hook.
|
||||
"""
|
||||
import Phoenix.LiveView
|
||||
import Phoenix.Component
|
||||
alias Cannery.Accounts
|
||||
|
||||
def on_mount(:default, _params, %{"locale" => locale, "user_token" => user_token}, socket) do
|
||||
|
@ -60,7 +60,7 @@ defmodule CanneryWeb.InviteLive.FormComponent do
|
||||
case invite |> Invites.update_invite(invite_params, current_user) do
|
||||
{:ok, %{name: invite_name}} ->
|
||||
prompt = dgettext("prompts", "%{name} updated successfully", name: invite_name)
|
||||
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
socket |> assign(:changeset, changeset)
|
||||
@ -78,7 +78,7 @@ defmodule CanneryWeb.InviteLive.FormComponent do
|
||||
case current_user |> Invites.create_invite(invite_params) do
|
||||
{:ok, %{name: invite_name}} ->
|
||||
prompt = dgettext("prompts", "%{name} created successfully", name: invite_name)
|
||||
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
socket |> assign(changeset: changeset)
|
||||
|
@ -3,7 +3,7 @@
|
||||
<%= @title %>
|
||||
</h2>
|
||||
<.form
|
||||
let={f}
|
||||
|