add search to container index

This commit is contained in:
shibao 2022-12-03 20:07:51 -05:00
parent 11ef53d1bf
commit 95642061db
26 changed files with 423 additions and 383 deletions

View File

@ -1,6 +1,6 @@
# v0.8.0
- Add search to catalog and ammo
- Tweak urls for catalog and ammo
- Add search to catalog, ammo and container index
- Tweak urls for catalog, ammo and containers
# v0.7.2
- Code improvements

View File

@ -17,17 +17,56 @@ defmodule Cannery.Containers do
iex> list_containers(%User{id: 123})
[%Container{}, ...]
iex> list_containers("cool", %User{id: 123})
[%Container{name: "my cool container"}, ...]
"""
@spec list_containers(User.t()) :: [Container.t()]
def list_containers(%User{id: user_id}) do
Repo.all(
from c in Container,
@spec list_containers(search :: nil | String.t(), User.t()) :: [Container.t()]
def list_containers(search \\ nil, %User{id: user_id}) do
from(c in Container,
as: :c,
left_join: t in assoc(c, :tags),
as: :t,
left_join: ag in assoc(c, :ammo_groups),
as: :ag,
where: c.user_id == ^user_id,
order_by: c.name,
preload: [tags: t, ammo_groups: ag]
)
|> list_containers_search(search)
|> Repo.all()
end
defp list_containers_search(query, nil), do: query
defp list_containers_search(query, ""), do: query
defp list_containers_search(query, search) do
trimmed_search = String.trim(search)
query
|> where(
[c: c, t: t],
fragment(
"? @@ websearch_to_tsquery('english', ?)",
c.search,
^trimmed_search
) or
fragment(
"? @@ websearch_to_tsquery('english', ?)",
t.search,
^trimmed_search
)
)
|> order_by(
[c: c],
desc:
fragment(
"ts_rank_cd(?, websearch_to_tsquery('english', ?), 4)",
c.search,
^trimmed_search
)
)
end
@doc """

View File

@ -10,7 +10,13 @@ defmodule CanneryWeb.ContainerLive.Index do
alias Ecto.Changeset
@impl true
def mount(_params, _session, socket), do: {:ok, socket |> assign(view_table: false)}
def mount(%{"search" => search}, _session, socket) do
{:ok, socket |> assign(view_table: true, search: search) |> display_containers()}
end
def mount(_params, _session, socket) do
{:ok, socket |> assign(view_table: true, search: nil) |> display_containers()}
end
@impl true
def handle_params(params, _url, %{assigns: %{live_action: live_action}} = socket) do
@ -21,7 +27,7 @@ defmodule CanneryWeb.ContainerLive.Index do
%{name: container_name} =
container =
Containers.get_container!(id, current_user)
|> Repo.preload([:tags, :ammo_groups], force: true)
|> Repo.preload([:tags, :ammo_groups])
socket
|> assign(page_title: gettext("Edit %{name}", name: container_name), container: container)
@ -42,19 +48,18 @@ defmodule CanneryWeb.ContainerLive.Index do
socket
|> assign(
page_title: gettext("Containers"),
container: nil
container: nil,
search: nil
)
|> display_containers()
end
defp apply_action(socket, :table, _params) do
defp apply_action(socket, :search, %{"search" => search}) do
socket
|> assign(
page_title: gettext("Containers"),
container: nil,
view_table: true
search: search
)
|> display_containers()
end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit_tags, %{"id" => id}) do
@ -104,17 +109,22 @@ defmodule CanneryWeb.ContainerLive.Index do
@impl true
def handle_event("toggle_table", _params, %{assigns: %{view_table: view_table}} = socket) do
new_path =
if view_table,
do: Routes.container_index_path(Endpoint, :index),
else: Routes.container_index_path(Endpoint, :table)
{:noreply, socket |> assign(view_table: !view_table) |> push_patch(to: new_path)}
{:noreply, socket |> assign(:view_table, !view_table) |> display_containers()}
end
defp display_containers(%{assigns: %{current_user: current_user}} = socket) do
@impl true
def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.container_index_path(Endpoint, :index))}
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))}
end
defp display_containers(%{assigns: %{search: search, current_user: current_user}} = socket) do
containers =
Containers.list_containers(current_user) |> Repo.preload([:tags, :ammo_groups], force: true)
Containers.list_containers(search, current_user) |> Repo.preload([:tags, :ammo_groups])
columns =
[
@ -243,7 +253,4 @@ defmodule CanneryWeb.ContainerLive.Index do
end
defp get_value_for_key(key, container), do: container |> Map.get(key)
def return_to(true = _view_table), do: Routes.container_index_path(Endpoint, :table)
def return_to(false = _view_table), do: Routes.container_index_path(Endpoint, :index)
end

View File

@ -3,7 +3,7 @@
<%= gettext("Containers") %>
</h1>
<%= if @containers |> Enum.empty?() do %>
<%= if @containers |> Enum.empty?() and @search |> is_nil() do %>
<h2 class="title text-xl text-primary-600">
<%= gettext("No containers") %>
<%= display_emoji("😔") %>
@ -17,7 +17,23 @@
<%= dgettext("actions", "New Container") %>
</.link>
<div class="flex flex-col justify-center items-center">
<div class="w-full flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-4 max-w-xl">
<.form
:let={f}
for={:search}
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
data-qa="container_search"
>
<%= text_input(f, :search_term,
class: "input input-primary",
value: @search,
phx_debounce: 300,
placeholder: gettext("Search containers")
) %>
</.form>
<.toggle_button action="toggle_table" value={@view_table}>
<span class="title text-lg text-primary-600">
<%= gettext("View as table") %>
@ -27,6 +43,12 @@
<% end %>
<div class="w-full flex flex-row flex-wrap justify-center items-center">
<%= if @containers |> Enum.empty?() do %>
<h2 class="title text-xl text-primary-600">
<%= gettext("No containers") %>
<%= display_emoji("😔") %>
</h2>
<% else %>
<%= if @view_table do %>
<.live_component
module={CanneryWeb.Components.TableComponent}
@ -70,7 +92,9 @@
phx-click="delete"
phx-value-id={container.id}
data-confirm={
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name)
dgettext("prompts", "Are you sure you want to delete %{name}?",
name: container.name
)
}
data-qa={"delete-#{container.id}"}
>
@ -79,25 +103,26 @@
</.container_card>
<% end %>
<% end %>
<% end %>
</div>
</div>
<%= if @live_action in [:new, :edit, :clone] do %>
<.modal return_to={return_to(@view_table)}>
<.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={return_to(@view_table)}
return_to={Routes.container_index_path(Endpoint, :index)}
current_user={@current_user}
/>
</.modal>
<% end %>
<%= if @live_action == :edit_tags do %>
<.modal return_to={return_to(@view_table)}>
<.modal return_to={Routes.container_index_path(Endpoint, :index)}>
<.live_component
module={CanneryWeb.ContainerLive.EditTagsComponent}
id={@container.id}

View File

@ -11,18 +11,14 @@ defmodule CanneryWeb.ContainerLive.Show do
alias Phoenix.LiveView.Socket
@impl true
def mount(_params, _session, %{assigns: %{live_action: live_action}} = socket),
do: {:ok, socket |> assign(show_used: false, view_table: live_action == :table)}
def mount(_params, _session, socket),
do: {:ok, socket |> assign(show_used: false, view_table: true)}
@impl true
def handle_params(
%{"id" => id},
_session,
%{assigns: %{current_user: current_user, live_action: live_action}} = socket
) do
def handle_params(%{"id" => id}, _session, %{assigns: %{current_user: current_user}} = socket) do
socket =
socket
|> assign(view_table: live_action == :table)
|> assign(view_table: true)
|> render_container(id, current_user)
{:noreply, socket}
@ -94,17 +90,8 @@ defmodule CanneryWeb.ContainerLive.Show do
end
@impl true
def handle_event(
"toggle_table",
_params,
%{assigns: %{view_table: view_table, container: container}} = socket
) do
new_path =
if view_table,
do: Routes.container_show_path(Endpoint, :show, container),
else: Routes.container_show_path(Endpoint, :table, container)
{:noreply, socket |> push_patch(to: new_path)}
def handle_event("toggle_table", _params, %{assigns: %{view_table: view_table}} = socket) do
{:noreply, socket |> assign(:view_table, !view_table) |> render_container()}
end
@spec render_container(Socket.t(), Container.id(), User.t()) :: Socket.t()

View File

@ -77,16 +77,15 @@ defmodule CanneryWeb.Router do
live "/type/:id/table", AmmoTypeLive.Show, :table
live "/containers", ContainerLive.Index, :index
live "/containers/table", ContainerLive.Index, :table
live "/containers/new", ContainerLive.Index, :new
live "/containers/:id/edit", ContainerLive.Index, :edit
live "/containers/:id/clone", ContainerLive.Index, :clone
live "/containers/:id/edit_tags", ContainerLive.Index, :edit_tags
live "/containers/edit/:id", ContainerLive.Index, :edit
live "/containers/clone/:id", ContainerLive.Index, :clone
live "/containers/edit_tags/:id", ContainerLive.Index, :edit_tags
live "/containers/search/:search", ContainerLive.Index, :search
live "/containers/:id/show", ContainerLive.Show, :show
live "/containers/:id/show/table", ContainerLive.Show, :table
live "/containers/:id/show/edit", ContainerLive.Show, :edit
live "/containers/:id/show/edit_tags", ContainerLive.Show, :edit_tags
live "/container/:id", ContainerLive.Show, :show
live "/container/edit/:id", ContainerLive.Show, :edit
live "/container/edit_tags/:id", ContainerLive.Show, :edit_tags
live "/ammo", AmmoGroupLive.Index, :index
live "/ammo/new", AmmoGroupLive.Index, :new

View File

@ -114,8 +114,8 @@ msgid "Container"
msgstr "Behälter"
#: lib/cannery_web/components/topbar.ex:57
#: lib/cannery_web/live/container_live/index.ex:44
#: lib/cannery_web/live/container_live/index.ex:53
#: lib/cannery_web/live/container_live/index.ex:50
#: lib/cannery_web/live/container_live/index.ex:59
#: lib/cannery_web/live/container_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@ -141,7 +141,7 @@ msgstr "Anzahl:"
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:24
#: lib/cannery_web/live/container_live/form_component.html.heex:27
#: lib/cannery_web/live/container_live/index.ex:122
#: lib/cannery_web/live/container_live/index.ex:132
#, elixir-autogen, elixir-format
msgid "Description"
msgstr "Beschreibung"
@ -218,7 +218,7 @@ msgstr "Für 60 Tage eingeloggt bleiben"
#: lib/cannery_web/components/move_ammo_group_component.ex:69
#: lib/cannery_web/live/container_live/form_component.html.heex:42
#: lib/cannery_web/live/container_live/index.ex:123
#: lib/cannery_web/live/container_live/index.ex:133
#, elixir-autogen, elixir-format
msgid "Location"
msgstr "Standort"
@ -253,7 +253,7 @@ msgstr "Meine coole Munitionskiste"
#: lib/cannery_web/components/ammo_type_table_component.ex:45
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/index.ex:121
#: lib/cannery_web/live/container_live/index.ex:131
#: lib/cannery_web/live/invite_live/form_component.html.heex:20
#: lib/cannery_web/live/tag_live/form_component.ex:75
#, elixir-autogen, elixir-format
@ -266,8 +266,8 @@ msgstr "Name"
msgid "New Ammo type"
msgstr "Neuer Munitionstyp"
#: lib/cannery_web/live/container_live/index.ex:31
#: lib/cannery_web/live/container_live/index.ex:38
#: lib/cannery_web/live/container_live/index.ex:37
#: lib/cannery_web/live/container_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr "Neuer Behälter"
@ -294,6 +294,7 @@ msgid "No ammo for this type"
msgstr "Keine Munition dieser Art"
#: lib/cannery_web/live/container_live/index.html.heex:8
#: lib/cannery_web/live/container_live/index.html.heex:48
#, elixir-autogen, elixir-format
msgid "No containers"
msgstr "Kein Behälter"
@ -392,7 +393,7 @@ msgid "Stored in"
msgstr "Gelagert in"
#: lib/cannery_web/components/topbar.ex:49
#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/container_live/index.ex:137
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@ -422,7 +423,7 @@ msgstr "Leuchtspur"
#: lib/cannery_web/components/move_ammo_group_component.ex:68
#: lib/cannery_web/live/container_live/form_component.html.heex:35
#: lib/cannery_web/live/container_live/index.ex:124
#: lib/cannery_web/live/container_live/index.ex:134
#, elixir-autogen, elixir-format
msgid "Type"
msgstr "Art"
@ -637,14 +638,14 @@ msgstr "Neu verbinden..."
msgid "Loading..."
msgstr "Lädt..."
#: lib/cannery_web/live/container_live/index.ex:27
#: lib/cannery_web/live/container_live/show.ex:126
#: lib/cannery_web/live/container_live/index.ex:33
#: lib/cannery_web/live/container_live/show.ex:113
#, elixir-autogen, elixir-format
msgid "Edit %{name}"
msgstr "%{name} bearbeiten"
#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:127
#: lib/cannery_web/live/container_live/index.ex:70
#: lib/cannery_web/live/container_live/show.ex:114
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
msgstr "Editiere %{name} Tags"
@ -863,19 +864,19 @@ msgid "Rounds shot: %{count}"
msgstr "Patronen abgefeuert"
#: lib/cannery_web/components/ammo_type_table_component.ex:100
#: lib/cannery_web/live/container_live/index.ex:125
#: lib/cannery_web/live/container_live/index.ex:135
#, elixir-autogen, elixir-format, fuzzy
msgid "Packs"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:80
#: lib/cannery_web/live/container_live/index.ex:126
#: lib/cannery_web/live/container_live/index.ex:136
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds"
msgstr "Patronen:"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:158
#: lib/cannery_web/live/container_live/index.html.heex:23
#: lib/cannery_web/live/container_live/index.html.heex:39
#: lib/cannery_web/live/container_live/show.html.heex:111
#, elixir-autogen, elixir-format
msgid "View as table"
@ -1126,3 +1127,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Search ammo"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:33
#, elixir-autogen, elixir-format
msgid "Search containers"
msgstr ""

View File

@ -23,18 +23,18 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery/containers.ex:140
#: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format
msgid "Container must be empty before deleting"
msgstr "Behälter muss vor dem Löschen leer sein"
#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:77
#: lib/cannery_web/live/container_live/index.ex:93
#: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}"
msgstr "Konnte %{name} nicht löschen: %{error}"
#: lib/cannery_web/live/container_live/index.ex:76
#: lib/cannery_web/live/container_live/index.ex:81
#, elixir-autogen, elixir-format
msgid "Could not find that container"
msgstr "Konnte Behälter nicht finden"

View File

@ -50,8 +50,8 @@ msgstr "%{name} erfolgreich deaktiviert"
msgid "%{name} enabled succesfully"
msgstr "%{name} erfolgreich aktiviert"
#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:67
#: lib/cannery_web/live/container_live/index.ex:86
#: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
msgstr "%{name} wurde gelöscht"
@ -82,8 +82,8 @@ msgstr ""
"Sind Sie sicher, dass sie %{email} löschen möchten? Dies kann nicht "
"zurückgenommen werden!"
#: lib/cannery_web/live/container_live/index.ex:236
#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/index.ex:246
#: lib/cannery_web/live/container_live/index.html.heex:95
#: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
@ -188,7 +188,7 @@ msgstr ""
msgid "%{name} added successfully"
msgstr "%{name} erfolgreich hinzugefügt"
#: lib/cannery_web/live/container_live/show.ex:43
#: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}"
msgstr "%{tag_name} wurde von %{container_name} entfernt"

View File

@ -99,8 +99,8 @@ msgid "Container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:57
#: lib/cannery_web/live/container_live/index.ex:44
#: lib/cannery_web/live/container_live/index.ex:53
#: lib/cannery_web/live/container_live/index.ex:50
#: lib/cannery_web/live/container_live/index.ex:59
#: lib/cannery_web/live/container_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@ -126,7 +126,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:24
#: lib/cannery_web/live/container_live/form_component.html.heex:27
#: lib/cannery_web/live/container_live/index.ex:122
#: lib/cannery_web/live/container_live/index.ex:132
#, elixir-autogen, elixir-format
msgid "Description"
msgstr ""
@ -203,7 +203,7 @@ msgstr ""
#: lib/cannery_web/components/move_ammo_group_component.ex:69
#: lib/cannery_web/live/container_live/form_component.html.heex:42
#: lib/cannery_web/live/container_live/index.ex:123
#: lib/cannery_web/live/container_live/index.ex:133
#, elixir-autogen, elixir-format
msgid "Location"
msgstr ""
@ -238,7 +238,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:45
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/index.ex:121
#: lib/cannery_web/live/container_live/index.ex:131
#: lib/cannery_web/live/invite_live/form_component.html.heex:20
#: lib/cannery_web/live/tag_live/form_component.ex:75
#, elixir-autogen, elixir-format
@ -251,8 +251,8 @@ msgstr ""
msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:31
#: lib/cannery_web/live/container_live/index.ex:38
#: lib/cannery_web/live/container_live/index.ex:37
#: lib/cannery_web/live/container_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr ""
@ -279,6 +279,7 @@ msgid "No ammo for this type"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:8
#: lib/cannery_web/live/container_live/index.html.heex:48
#, elixir-autogen, elixir-format
msgid "No containers"
msgstr ""
@ -375,7 +376,7 @@ msgid "Stored in"
msgstr ""
#: lib/cannery_web/components/topbar.ex:49
#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/container_live/index.ex:137
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@ -405,7 +406,7 @@ msgstr ""
#: lib/cannery_web/components/move_ammo_group_component.ex:68
#: lib/cannery_web/live/container_live/form_component.html.heex:35
#: lib/cannery_web/live/container_live/index.ex:124
#: lib/cannery_web/live/container_live/index.ex:134
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@ -620,14 +621,14 @@ msgstr ""
msgid "Loading..."
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:27
#: lib/cannery_web/live/container_live/show.ex:126
#: lib/cannery_web/live/container_live/index.ex:33
#: lib/cannery_web/live/container_live/show.ex:113
#, elixir-autogen, elixir-format
msgid "Edit %{name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:127
#: lib/cannery_web/live/container_live/index.ex:70
#: lib/cannery_web/live/container_live/show.ex:114
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
msgstr ""
@ -846,19 +847,19 @@ msgid "Rounds shot: %{count}"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:100
#: lib/cannery_web/live/container_live/index.ex:125
#: lib/cannery_web/live/container_live/index.ex:135
#, elixir-autogen, elixir-format
msgid "Packs"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:80
#: lib/cannery_web/live/container_live/index.ex:126
#: lib/cannery_web/live/container_live/index.ex:136
#, elixir-autogen, elixir-format
msgid "Rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:158
#: lib/cannery_web/live/container_live/index.html.heex:23
#: lib/cannery_web/live/container_live/index.html.heex:39
#: lib/cannery_web/live/container_live/show.html.heex:111
#, elixir-autogen, elixir-format
msgid "View as table"
@ -1109,3 +1110,8 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Search ammo"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:33
#, elixir-autogen, elixir-format
msgid "Search containers"
msgstr ""

View File

@ -100,8 +100,8 @@ msgid "Container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:57
#: lib/cannery_web/live/container_live/index.ex:44
#: lib/cannery_web/live/container_live/index.ex:53
#: lib/cannery_web/live/container_live/index.ex:50
#: lib/cannery_web/live/container_live/index.ex:59
#: lib/cannery_web/live/container_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@ -127,7 +127,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:24
#: lib/cannery_web/live/container_live/form_component.html.heex:27
#: lib/cannery_web/live/container_live/index.ex:122
#: lib/cannery_web/live/container_live/index.ex:132
#, elixir-autogen, elixir-format
msgid "Description"
msgstr ""
@ -204,7 +204,7 @@ msgstr ""
#: lib/cannery_web/components/move_ammo_group_component.ex:69
#: lib/cannery_web/live/container_live/form_component.html.heex:42
#: lib/cannery_web/live/container_live/index.ex:123
#: lib/cannery_web/live/container_live/index.ex:133
#, elixir-autogen, elixir-format
msgid "Location"
msgstr ""
@ -239,7 +239,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:45
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/index.ex:121
#: lib/cannery_web/live/container_live/index.ex:131
#: lib/cannery_web/live/invite_live/form_component.html.heex:20
#: lib/cannery_web/live/tag_live/form_component.ex:75
#, elixir-autogen, elixir-format
@ -252,8 +252,8 @@ msgstr ""
msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:31
#: lib/cannery_web/live/container_live/index.ex:38
#: lib/cannery_web/live/container_live/index.ex:37
#: lib/cannery_web/live/container_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr ""
@ -280,6 +280,7 @@ msgid "No ammo for this type"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:8
#: lib/cannery_web/live/container_live/index.html.heex:48
#, elixir-autogen, elixir-format
msgid "No containers"
msgstr ""
@ -376,7 +377,7 @@ msgid "Stored in"
msgstr ""
#: lib/cannery_web/components/topbar.ex:49
#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/container_live/index.ex:137
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@ -406,7 +407,7 @@ msgstr ""
#: lib/cannery_web/components/move_ammo_group_component.ex:68
#: lib/cannery_web/live/container_live/form_component.html.heex:35
#: lib/cannery_web/live/container_live/index.ex:124
#: lib/cannery_web/live/container_live/index.ex:134
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@ -621,14 +622,14 @@ msgstr ""
msgid "Loading..."
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:27
#: lib/cannery_web/live/container_live/show.ex:126
#: lib/cannery_web/live/container_live/index.ex:33
#: lib/cannery_web/live/container_live/show.ex:113
#, elixir-autogen, elixir-format
msgid "Edit %{name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:127
#: lib/cannery_web/live/container_live/index.ex:70
#: lib/cannery_web/live/container_live/show.ex:114
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
msgstr ""
@ -847,19 +848,19 @@ msgid "Rounds shot: %{count}"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:100
#: lib/cannery_web/live/container_live/index.ex:125
#: lib/cannery_web/live/container_live/index.ex:135
#, elixir-autogen, elixir-format, fuzzy
msgid "Packs"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:80
#: lib/cannery_web/live/container_live/index.ex:126
#: lib/cannery_web/live/container_live/index.ex:136
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:158
#: lib/cannery_web/live/container_live/index.html.heex:23
#: lib/cannery_web/live/container_live/index.html.heex:39
#: lib/cannery_web/live/container_live/show.html.heex:111
#, elixir-autogen, elixir-format
msgid "View as table"
@ -1110,3 +1111,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Search ammo"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:33
#, elixir-autogen, elixir-format
msgid "Search containers"
msgstr ""

View File

@ -10,18 +10,18 @@ msgid ""
msgstr ""
"Language: en\n"
#: lib/cannery/containers.ex:140
#: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format
msgid "Container must be empty before deleting"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:77
#: lib/cannery_web/live/container_live/index.ex:93
#: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:76
#: lib/cannery_web/live/container_live/index.ex:81
#, elixir-autogen, elixir-format
msgid "Could not find that container"
msgstr ""

View File

@ -38,8 +38,8 @@ msgstr ""
msgid "%{name} enabled succesfully"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:67
#: lib/cannery_web/live/container_live/index.ex:86
#: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
msgstr ""
@ -68,8 +68,8 @@ msgstr ""
msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:236
#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/index.ex:246
#: lib/cannery_web/live/container_live/index.html.heex:95
#: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
@ -168,7 +168,7 @@ msgstr ""
msgid "%{name} added successfully"
msgstr ""
#: lib/cannery_web/live/container_live/show.ex:43
#: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}"
msgstr ""

View File

@ -10,18 +10,18 @@
msgid ""
msgstr ""
#: lib/cannery/containers.ex:140
#: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format
msgid "Container must be empty before deleting"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:77
#: lib/cannery_web/live/container_live/index.ex:93
#: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:76
#: lib/cannery_web/live/container_live/index.ex:81
#, elixir-autogen, elixir-format
msgid "Could not find that container"
msgstr ""

View File

@ -114,8 +114,8 @@ msgid "Container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:57
#: lib/cannery_web/live/container_live/index.ex:44
#: lib/cannery_web/live/container_live/index.ex:53
#: lib/cannery_web/live/container_live/index.ex:50
#: lib/cannery_web/live/container_live/index.ex:59
#: lib/cannery_web/live/container_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@ -141,7 +141,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:24
#: lib/cannery_web/live/container_live/form_component.html.heex:27
#: lib/cannery_web/live/container_live/index.ex:122
#: lib/cannery_web/live/container_live/index.ex:132
#, elixir-autogen, elixir-format
msgid "Description"
msgstr ""
@ -218,7 +218,7 @@ msgstr ""
#: lib/cannery_web/components/move_ammo_group_component.ex:69
#: lib/cannery_web/live/container_live/form_component.html.heex:42
#: lib/cannery_web/live/container_live/index.ex:123
#: lib/cannery_web/live/container_live/index.ex:133
#, elixir-autogen, elixir-format
msgid "Location"
msgstr ""
@ -253,7 +253,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:45
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/index.ex:121
#: lib/cannery_web/live/container_live/index.ex:131
#: lib/cannery_web/live/invite_live/form_component.html.heex:20
#: lib/cannery_web/live/tag_live/form_component.ex:75
#, elixir-autogen, elixir-format
@ -266,8 +266,8 @@ msgstr ""
msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:31
#: lib/cannery_web/live/container_live/index.ex:38
#: lib/cannery_web/live/container_live/index.ex:37
#: lib/cannery_web/live/container_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr ""
@ -294,6 +294,7 @@ msgid "No ammo for this type"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:8
#: lib/cannery_web/live/container_live/index.html.heex:48
#, elixir-autogen, elixir-format
msgid "No containers"
msgstr ""
@ -390,7 +391,7 @@ msgid "Stored in"
msgstr ""
#: lib/cannery_web/components/topbar.ex:49
#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/container_live/index.ex:137
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@ -420,7 +421,7 @@ msgstr ""
#: lib/cannery_web/components/move_ammo_group_component.ex:68
#: lib/cannery_web/live/container_live/form_component.html.heex:35
#: lib/cannery_web/live/container_live/index.ex:124
#: lib/cannery_web/live/container_live/index.ex:134
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@ -635,14 +636,14 @@ msgstr ""
msgid "Loading..."
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:27
#: lib/cannery_web/live/container_live/show.ex:126
#: lib/cannery_web/live/container_live/index.ex:33
#: lib/cannery_web/live/container_live/show.ex:113
#, elixir-autogen, elixir-format
msgid "Edit %{name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:127
#: lib/cannery_web/live/container_live/index.ex:70
#: lib/cannery_web/live/container_live/show.ex:114
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
msgstr ""
@ -861,19 +862,19 @@ msgid "Rounds shot: %{count}"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:100
#: lib/cannery_web/live/container_live/index.ex:125
#: lib/cannery_web/live/container_live/index.ex:135
#, elixir-autogen, elixir-format, fuzzy
msgid "Packs"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:80
#: lib/cannery_web/live/container_live/index.ex:126
#: lib/cannery_web/live/container_live/index.ex:136
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:158
#: lib/cannery_web/live/container_live/index.html.heex:23
#: lib/cannery_web/live/container_live/index.html.heex:39
#: lib/cannery_web/live/container_live/show.html.heex:111
#, elixir-autogen, elixir-format
msgid "View as table"
@ -1124,3 +1125,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Search ammo"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:33
#, elixir-autogen, elixir-format
msgid "Search containers"
msgstr ""

View File

@ -23,18 +23,18 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery/containers.ex:140
#: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format
msgid "Container must be empty before deleting"
msgstr "El contenedor debe estar vacío antes de ser borrado"
#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:77
#: lib/cannery_web/live/container_live/index.ex:93
#: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}"
msgstr "No se pudo eliminar %{name}: %{error}"
#: lib/cannery_web/live/container_live/index.ex:76
#: lib/cannery_web/live/container_live/index.ex:81
#, elixir-autogen, elixir-format
msgid "Could not find that container"
msgstr "No se pudo encontrar el contenedor"

View File

@ -50,8 +50,8 @@ msgstr "%{name} desactivado exitosamente"
msgid "%{name} enabled succesfully"
msgstr "%{name} activado exitosamente"
#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:67
#: lib/cannery_web/live/container_live/index.ex:86
#: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
msgstr "%{name} ha sido borrado"
@ -82,8 +82,8 @@ msgstr ""
msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "Está seguro que desea eliminar %{email}? Esta acción es permanente!"
#: lib/cannery_web/live/container_live/index.ex:236
#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/index.ex:246
#: lib/cannery_web/live/container_live/index.html.heex:95
#: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
@ -187,7 +187,7 @@ msgstr ""
msgid "%{name} added successfully"
msgstr "%{name} añadido exitosamente"
#: lib/cannery_web/live/container_live/show.ex:43
#: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}"
msgstr "se ha removido %{tag_name} de %{container_name}"

View File

@ -114,8 +114,8 @@ msgid "Container"
msgstr "Conteneur"
#: lib/cannery_web/components/topbar.ex:57
#: lib/cannery_web/live/container_live/index.ex:44
#: lib/cannery_web/live/container_live/index.ex:53
#: lib/cannery_web/live/container_live/index.ex:50
#: lib/cannery_web/live/container_live/index.ex:59
#: lib/cannery_web/live/container_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@ -141,7 +141,7 @@ msgstr "Quantité:"
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:24
#: lib/cannery_web/live/container_live/form_component.html.heex:27
#: lib/cannery_web/live/container_live/index.ex:122
#: lib/cannery_web/live/container_live/index.ex:132
#, elixir-autogen, elixir-format
msgid "Description"
msgstr "Description"
@ -218,7 +218,7 @@ msgstr "Me garder authentifié durant 60 jours"
#: lib/cannery_web/components/move_ammo_group_component.ex:69
#: lib/cannery_web/live/container_live/form_component.html.heex:42
#: lib/cannery_web/live/container_live/index.ex:123
#: lib/cannery_web/live/container_live/index.ex:133
#, elixir-autogen, elixir-format
msgid "Location"
msgstr "Localisation"
@ -253,7 +253,7 @@ msgstr "Ma superbe boite de munition"
#: lib/cannery_web/components/ammo_type_table_component.ex:45
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/index.ex:121
#: lib/cannery_web/live/container_live/index.ex:131
#: lib/cannery_web/live/invite_live/form_component.html.heex:20
#: lib/cannery_web/live/tag_live/form_component.ex:75
#, elixir-autogen, elixir-format
@ -266,8 +266,8 @@ msgstr "Nom"
msgid "New Ammo type"
msgstr "Nouveau type de munition"
#: lib/cannery_web/live/container_live/index.ex:31
#: lib/cannery_web/live/container_live/index.ex:38
#: lib/cannery_web/live/container_live/index.ex:37
#: lib/cannery_web/live/container_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr "Nouveau conteneur"
@ -294,6 +294,7 @@ msgid "No ammo for this type"
msgstr "Aucune munition pour ce type"
#: lib/cannery_web/live/container_live/index.html.heex:8
#: lib/cannery_web/live/container_live/index.html.heex:48
#, elixir-autogen, elixir-format
msgid "No containers"
msgstr "Aucun conteneur"
@ -392,7 +393,7 @@ msgid "Stored in"
msgstr "Est stocké dans"
#: lib/cannery_web/components/topbar.ex:49
#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/container_live/index.ex:137
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@ -424,7 +425,7 @@ msgstr "Traceuse"
#: lib/cannery_web/components/move_ammo_group_component.ex:68
#: lib/cannery_web/live/container_live/form_component.html.heex:35
#: lib/cannery_web/live/container_live/index.ex:124
#: lib/cannery_web/live/container_live/index.ex:134
#, elixir-autogen, elixir-format
msgid "Type"
msgstr "Type"
@ -639,14 +640,14 @@ msgstr "Reconnexion en cours…"
msgid "Loading..."
msgstr "Chargement en cours…"
#: lib/cannery_web/live/container_live/index.ex:27
#: lib/cannery_web/live/container_live/show.ex:126
#: lib/cannery_web/live/container_live/index.ex:33
#: lib/cannery_web/live/container_live/show.ex:113
#, elixir-autogen, elixir-format
msgid "Edit %{name}"
msgstr "Éditer %{name}"
#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:127
#: lib/cannery_web/live/container_live/index.ex:70
#: lib/cannery_web/live/container_live/show.ex:114
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
msgstr "Éditer les tags de %{name}"
@ -866,19 +867,19 @@ msgid "Rounds shot: %{count}"
msgstr "Cartouches tirées"
#: lib/cannery_web/components/ammo_type_table_component.ex:100
#: lib/cannery_web/live/container_live/index.ex:125
#: lib/cannery_web/live/container_live/index.ex:135
#, elixir-autogen, elixir-format, fuzzy
msgid "Packs"
msgstr "Packages:"
#: lib/cannery_web/components/ammo_type_table_component.ex:80
#: lib/cannery_web/live/container_live/index.ex:126
#: lib/cannery_web/live/container_live/index.ex:136
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds"
msgstr "Cartouches:"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:158
#: lib/cannery_web/live/container_live/index.html.heex:23
#: lib/cannery_web/live/container_live/index.html.heex:39
#: lib/cannery_web/live/container_live/show.html.heex:111
#, elixir-autogen, elixir-format
msgid "View as table"
@ -1129,3 +1130,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Search ammo"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:33
#, elixir-autogen, elixir-format
msgid "Search containers"
msgstr ""

View File

@ -23,18 +23,18 @@ msgstr ""
# # Run "mix gettext.extract" to bring this file up to
# # date. Leave "msgstr"s empty as changing them here has no
# # effect: edit them in PO (.po) files instead.
#: lib/cannery/containers.ex:140
#: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format
msgid "Container must be empty before deleting"
msgstr "Le conteneur doit être vide pour être supprimé"
#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:77
#: lib/cannery_web/live/container_live/index.ex:93
#: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}"
msgstr "Impossible de supprimer %{name} : %{error}"
#: lib/cannery_web/live/container_live/index.ex:76
#: lib/cannery_web/live/container_live/index.ex:81
#, elixir-autogen, elixir-format
msgid "Could not find that container"
msgstr "Impossible de trouver ce conteneur"

View File

@ -50,8 +50,8 @@ msgstr "%{name} supprimé·e avec succès"
msgid "%{name} enabled succesfully"
msgstr "%{name} activé·e avec succès"
#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:67
#: lib/cannery_web/live/container_live/index.ex:86
#: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
msgstr "%{name} a été supprimé·e"
@ -83,8 +83,8 @@ msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr ""
"Êtes-vous certain·e de supprimer %{email}? Cette action est définitive!"
#: lib/cannery_web/live/container_live/index.ex:236
#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/index.ex:246
#: lib/cannery_web/live/container_live/index.html.heex:95
#: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
@ -189,7 +189,7 @@ msgstr ""
msgid "%{name} added successfully"
msgstr "%{name} a été ajouté avec succès"
#: lib/cannery_web/live/container_live/show.ex:43
#: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}"
msgstr "%{tag_name} a été retiré de %{container_name}"

View File

@ -110,8 +110,8 @@ msgid "Container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:57
#: lib/cannery_web/live/container_live/index.ex:44
#: lib/cannery_web/live/container_live/index.ex:53
#: lib/cannery_web/live/container_live/index.ex:50
#: lib/cannery_web/live/container_live/index.ex:59
#: lib/cannery_web/live/container_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@ -137,7 +137,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:24
#: lib/cannery_web/live/container_live/form_component.html.heex:27
#: lib/cannery_web/live/container_live/index.ex:122
#: lib/cannery_web/live/container_live/index.ex:132
#, elixir-autogen, elixir-format
msgid "Description"
msgstr ""
@ -214,7 +214,7 @@ msgstr ""
#: lib/cannery_web/components/move_ammo_group_component.ex:69
#: lib/cannery_web/live/container_live/form_component.html.heex:42
#: lib/cannery_web/live/container_live/index.ex:123
#: lib/cannery_web/live/container_live/index.ex:133
#, elixir-autogen, elixir-format
msgid "Location"
msgstr ""
@ -249,7 +249,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:45
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/form_component.html.heex:20
#: lib/cannery_web/live/container_live/index.ex:121
#: lib/cannery_web/live/container_live/index.ex:131
#: lib/cannery_web/live/invite_live/form_component.html.heex:20
#: lib/cannery_web/live/tag_live/form_component.ex:75
#, elixir-autogen, elixir-format
@ -262,8 +262,8 @@ msgstr ""
msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:31
#: lib/cannery_web/live/container_live/index.ex:38
#: lib/cannery_web/live/container_live/index.ex:37
#: lib/cannery_web/live/container_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr ""
@ -290,6 +290,7 @@ msgid "No ammo for this type"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:8
#: lib/cannery_web/live/container_live/index.html.heex:48
#, elixir-autogen, elixir-format
msgid "No containers"
msgstr ""
@ -386,7 +387,7 @@ msgid "Stored in"
msgstr ""
#: lib/cannery_web/components/topbar.ex:49
#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/container_live/index.ex:137
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@ -416,7 +417,7 @@ msgstr ""
#: lib/cannery_web/components/move_ammo_group_component.ex:68
#: lib/cannery_web/live/container_live/form_component.html.heex:35
#: lib/cannery_web/live/container_live/index.ex:124
#: lib/cannery_web/live/container_live/index.ex:134
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@ -631,14 +632,14 @@ msgstr ""
msgid "Loading..."
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:27
#: lib/cannery_web/live/container_live/show.ex:126
#: lib/cannery_web/live/container_live/index.ex:33
#: lib/cannery_web/live/container_live/show.ex:113
#, elixir-autogen, elixir-format
msgid "Edit %{name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:127
#: lib/cannery_web/live/container_live/index.ex:70
#: lib/cannery_web/live/container_live/show.ex:114
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
msgstr ""
@ -857,19 +858,19 @@ msgid "Rounds shot: %{count}"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:100
#: lib/cannery_web/live/container_live/index.ex:125
#: lib/cannery_web/live/container_live/index.ex:135
#, elixir-autogen, elixir-format, fuzzy
msgid "Packs"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:80
#: lib/cannery_web/live/container_live/index.ex:126
#: lib/cannery_web/live/container_live/index.ex:136
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:158
#: lib/cannery_web/live/container_live/index.html.heex:23
#: lib/cannery_web/live/container_live/index.html.heex:39
#: lib/cannery_web/live/container_live/show.html.heex:111
#, elixir-autogen, elixir-format
msgid "View as table"
@ -1120,3 +1121,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Search ammo"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:33
#, elixir-autogen, elixir-format
msgid "Search containers"
msgstr ""

View File

@ -24,18 +24,18 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery/containers.ex:140
#: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format
msgid "Container must be empty before deleting"
msgstr "Caithfidh an coimeádán a bheidh follamh roimh scriosadh"
#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:77
#: lib/cannery_web/live/container_live/index.ex:93
#: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}"
msgstr "Ní feidir %{name} a scriosadh: %{error}"
#: lib/cannery_web/live/container_live/index.ex:76
#: lib/cannery_web/live/container_live/index.ex:81
#, elixir-autogen, elixir-format
msgid "Could not find that container"
msgstr "Ní feidir an coimeádán sin a fáil"

View File

@ -48,8 +48,8 @@ msgstr ""
msgid "%{name} enabled succesfully"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:67
#: lib/cannery_web/live/container_live/index.ex:86
#: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
msgstr ""
@ -78,8 +78,8 @@ msgstr ""
msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:236
#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/index.ex:246
#: lib/cannery_web/live/container_live/index.html.heex:95
#: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
@ -178,7 +178,7 @@ msgstr ""
msgid "%{name} added successfully"
msgstr ""
#: lib/cannery_web/live/container_live/show.ex:43
#: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}"
msgstr ""

View File

@ -37,8 +37,8 @@ msgstr ""
msgid "%{name} enabled succesfully"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:67
#: lib/cannery_web/live/container_live/index.ex:86
#: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
msgstr ""
@ -67,8 +67,8 @@ msgstr ""
msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:236
#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/index.ex:246
#: lib/cannery_web/live/container_live/index.html.heex:95
#: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
@ -167,7 +167,7 @@ msgstr ""
msgid "%{name} added successfully"
msgstr ""
#: lib/cannery_web/live/container_live/show.ex:43
#: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}"
msgstr ""

View File

@ -34,9 +34,47 @@ defmodule Cannery.ContainersTest do
test "list_containers/1 returns all containers",
%{current_user: current_user, container: container} do
assert Containers.list_containers(current_user) ==
[container |> Repo.preload([:ammo_groups, :tags])]
[container] |> preload_containers()
end
test "list_containers/2 returns relevant containers for a user",
%{current_user: current_user} do
container_a =
container_fixture(%{"name" => "my cool container"}, current_user) |> preload_containers()
container_b =
container_fixture(%{"desc" => "a fascinating description"}, current_user)
|> preload_containers()
container_c = container_fixture(%{"location" => "a secret place"}, current_user)
tag = tag_fixture(%{"name" => "stupendous tag"}, current_user)
Containers.add_tag!(container_c, tag, current_user)
container_c = container_c |> preload_containers()
container_d = container_fixture(%{"type" => "musty old box"}, current_user)
tag = tag_fixture(%{"name" => "amazing tag"}, current_user)
Containers.add_tag!(container_d, tag, current_user)
container_d = container_d |> preload_containers()
_shouldnt_return =
container_fixture(%{"name" => "another person's container"}, user_fixture())
# attributes
assert Containers.list_containers("cool", current_user) == [container_a]
assert Containers.list_containers("fascinating", current_user) == [container_b]
assert Containers.list_containers("secret", current_user) == [container_c]
assert Containers.list_containers("box", current_user) == [container_d]
# tags
assert Containers.list_containers("stupendous", current_user) == [container_c]
assert Containers.list_containers("amazing", current_user) == [container_d]
assert Containers.list_containers("asajslkdflskdf", current_user) == []
end
defp preload_containers(containers),
do: containers |> Repo.preload([:ammo_groups, :tags])
test "get_container!/1 returns the container with given id",
%{current_user: current_user, container: container} do
assert Containers.get_container!(container.id, current_user) ==

View File

@ -62,7 +62,7 @@ defmodule CanneryWeb.ContainerLiveTest do
%{ammo_type: ammo_type, ammo_group: ammo_group, shot_group: shot_group}
end
describe "Index regular" do
describe "Index" do
setup [:register_and_log_in_user, :create_container]
test "lists all containers", %{conn: conn, container: container} do
@ -72,132 +72,43 @@ defmodule CanneryWeb.ContainerLiveTest do
assert html =~ container.location
end
test "saves new container", %{conn: conn, container: container} do
test "lists all containers in table mode", %{conn: conn, container: container} do
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index))
assert index_live |> element("a", dgettext("actions", "New Container")) |> render_click() =~
gettext("New Container")
assert_patch(index_live, Routes.container_index_path(conn, :new))
# assert index_live
# |> form("#container-form", container: @invalid_attrs)
# |> render_change() =~ dgettext("errors", "can't be blank")
{:ok, _view, html} =
index_live
|> form("#container-form", container: @create_attrs)
|> render_submit()
|> follow_redirect(conn, Routes.container_index_path(conn, :index))
assert html =~ dgettext("prompts", "%{name} created successfully", name: container.name)
assert html =~ "some location"
end
test "updates container in listing", %{
conn: conn,
current_user: current_user,
container: container
} do
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index))
assert index_live |> element("[data-qa=\"edit-#{container.id}\"]") |> render_click() =~
gettext("Edit %{name}", name: container.name)
assert_patch(index_live, Routes.container_index_path(conn, :edit, container))
# assert index_live
# |> form("#container-form", container: @invalid_attrs)
# |> render_change() =~ dgettext("errors", "can't be blank")
{:ok, _view, html} =
index_live
|> form("#container-form", container: @update_attrs)
|> render_submit()
|> follow_redirect(conn, Routes.container_index_path(conn, :index))
container = container.id |> Containers.get_container!(current_user)
assert html =~ dgettext("prompts", "%{name} updated successfully", name: container.name)
assert html =~ "some updated location"
end
test "clones container in listing", %{
conn: conn,
current_user: current_user,
container: container
} do
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index))
html = index_live |> element("[data-qa=\"clone-#{container.id}\"]") |> render_click()
assert html =~ gettext("New Container")
assert html =~ "some location"
assert_patch(index_live, Routes.container_index_path(conn, :clone, container))
# assert index_live
# |> form("#container-form", container: @invalid_attrs)
# |> render_change() =~ dgettext("errors", "can't be blank")
{:ok, _view, html} =
index_live
|> form("#container-form", container: @create_attrs)
|> render_submit()
|> follow_redirect(conn, Routes.container_index_path(conn, :index))
container = container.id |> Containers.get_container!(current_user)
assert html =~ dgettext("prompts", "%{name} created successfully", name: container.name)
assert html =~ "some location"
end
test "clones container in listing with updates", %{
conn: conn,
current_user: current_user,
container: container
} do
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index))
assert index_live |> element("[data-qa=\"clone-#{container.id}\"]") |> render_click() =~
gettext("New Container")
assert_patch(index_live, Routes.container_index_path(conn, :clone, container))
# assert index_live
# |> form("#container-form", container: @invalid_attrs)
# |> render_change() =~ dgettext("errors", "can't be blank")
{:ok, _view, html} =
index_live
|> form("#container-form",
container: Map.merge(@create_attrs, %{location: "some updated location"})
)
|> render_submit()
|> follow_redirect(conn, Routes.container_index_path(conn, :index))
container = container.id |> Containers.get_container!(current_user)
assert html =~ dgettext("prompts", "%{name} created successfully", name: container.name)
assert html =~ "some updated location"
end
test "deletes container in listing", %{conn: conn, container: container} do
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index))
assert index_live |> element("[data-qa=\"delete-#{container.id}\"]") |> render_click()
refute has_element?(index_live, "#container-#{container.id}")
end
end
describe "Index table" do
setup [:register_and_log_in_user, :create_container]
test "lists all containers", %{conn: conn, container: container} do
{:ok, _index_live, html} = live(conn, Routes.container_index_path(conn, :table))
html = index_live |> element("[data-qa=\"toggle_table\"]") |> render_click()
assert html =~ gettext("Containers")
assert html =~ container.location
end
test "can search for containers", %{conn: conn, container: container} do
{:ok, index_live, html} = live(conn, Routes.container_index_path(conn, :index))
assert html =~ container.location
assert index_live
|> form("[data-qa=\"container_search\"]",
search: %{search_term: container.location}
)
|> render_change() =~ container.location
assert_patch(index_live, Routes.container_index_path(conn, :search, container.location))
refute index_live
|> form("[data-qa=\"container_search\"]", search: %{search_term: "something_else"})
|> render_change() =~ container.location
assert_patch(index_live, Routes.container_index_path(conn, :search, "something_else"))
assert index_live
|> form("[data-qa=\"container_search\"]", search: %{search_term: ""})
|> render_change() =~ container.location
assert_patch(index_live, Routes.container_index_path(conn, :index))
end
test "saves new container", %{conn: conn, container: container} do
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :table))
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index))
assert index_live |> element("a", dgettext("actions", "New Container")) |> render_click() =~
gettext("New Container")
@ -212,7 +123,7 @@ defmodule CanneryWeb.ContainerLiveTest do
index_live
|> form("#container-form", container: @create_attrs)
|> render_submit()
|> follow_redirect(conn, Routes.container_index_path(conn, :table))
|> follow_redirect(conn, Routes.container_index_path(conn, :index))
assert html =~ dgettext("prompts", "%{name} created successfully", name: container.name)
assert html =~ "some location"
@ -223,7 +134,7 @@ defmodule CanneryWeb.ContainerLiveTest do
current_user: current_user,
container: container
} do
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :table))
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index))
assert index_live |> element("[data-qa=\"edit-#{container.id}\"]") |> render_click() =~
gettext("Edit %{name}", name: container.name)
@ -238,7 +149,7 @@ defmodule CanneryWeb.ContainerLiveTest do
index_live
|> form("#container-form", container: @update_attrs)
|> render_submit()
|> follow_redirect(conn, Routes.container_index_path(conn, :table))
|> follow_redirect(conn, Routes.container_index_path(conn, :index))
container = container.id |> Containers.get_container!(current_user)
assert html =~ dgettext("prompts", "%{name} updated successfully", name: container.name)
@ -303,7 +214,7 @@ defmodule CanneryWeb.ContainerLiveTest do
end
test "deletes container in listing", %{conn: conn, container: container} do
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :table))
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index))
assert index_live |> element("[data-qa=\"delete-#{container.id}\"]") |> render_click()
refute has_element?(index_live, "#container-#{container.id}")
@ -367,7 +278,6 @@ defmodule CanneryWeb.ContainerLiveTest do
{:ok, show_live, _html} = live(conn, Routes.container_show_path(conn, :show, container))
html = show_live |> element("[data-qa=\"toggle_table\"]") |> render_click()
assert_patch(show_live, Routes.container_show_path(conn, :table, container))
assert html =~ ammo_type_name
assert html =~ "some ammo group"
@ -396,7 +306,6 @@ defmodule CanneryWeb.ContainerLiveTest do
{:ok, show_live, _html} = live(conn, Routes.container_show_path(conn, :show, container))
html = show_live |> element("[data-qa=\"toggle_table\"]") |> render_click()
assert_patch(show_live, Routes.container_show_path(conn, :table, container))
assert html =~ dgettext("actions", "Show used")
refute html =~ "some ammo group"