+
+ <.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")
+ ) %>
+
+
<.toggle_button action="toggle_table" value={@view_table}>
<%= gettext("View as table") %>
@@ -27,77 +43,86 @@
<% end %>
- <%= if @view_table do %>
- <.live_component
- module={CanneryWeb.Components.TableComponent}
- id="containers_index_table"
- action={@live_action}
- columns={@columns}
- rows={@rows}
- />
+ <%= if @containers |> Enum.empty?() do %>
+
+ <%= gettext("No containers") %>
+ <%= display_emoji("😔") %>
+
<% else %>
- <%= for container <- @containers do %>
- <.container_card container={container}>
- <:tag_actions>
-
- <.link
- patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
- class="text-primary-600 link"
- >
-
-
-
-
- <.link
- patch={Routes.container_index_path(Endpoint, :edit, container)}
- class="text-primary-600 link"
- data-qa={"edit-#{container.id}"}
- >
-
-
+ <%= if @view_table do %>
+ <.live_component
+ module={CanneryWeb.Components.TableComponent}
+ id="containers_index_table"
+ action={@live_action}
+ columns={@columns}
+ rows={@rows}
+ />
+ <% else %>
+ <%= for container <- @containers do %>
+ <.container_card container={container}>
+ <:tag_actions>
+
+ <.link
+ patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
+ class="text-primary-600 link"
+ >
+
+
+
+
+ <.link
+ patch={Routes.container_index_path(Endpoint, :edit, container)}
+ class="text-primary-600 link"
+ data-qa={"edit-#{container.id}"}
+ >
+
+
- <.link
- patch={Routes.container_index_path(Endpoint, :clone, container)}
- class="text-primary-600 link"
- data-qa={"clone-#{container.id}"}
- >
-
-
+ <.link
+ patch={Routes.container_index_path(Endpoint, :clone, container)}
+ class="text-primary-600 link"
+ data-qa={"clone-#{container.id}"}
+ >
+
+
- <.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}"}
- >
-
-
-
+ <.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}"}
+ >
+
+
+
+ <% end %>
<% end %>
<% end %>
<%= 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}
/>
<% 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}
diff --git a/lib/cannery_web/live/container_live/show.ex b/lib/cannery_web/live/container_live/show.ex
index 8f94eedf..1565317d 100644
--- a/lib/cannery_web/live/container_live/show.ex
+++ b/lib/cannery_web/live/container_live/show.ex
@@ -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()
diff --git a/lib/cannery_web/router.ex b/lib/cannery_web/router.ex
index fcd2b1c0..c103c149 100644
--- a/lib/cannery_web/router.ex
+++ b/lib/cannery_web/router.ex
@@ -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
diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po
index 4ca76e90..0853b9e6 100644
--- a/priv/gettext/de/LC_MESSAGES/default.po
+++ b/priv/gettext/de/LC_MESSAGES/default.po
@@ -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 ""
diff --git a/priv/gettext/de/LC_MESSAGES/errors.po b/priv/gettext/de/LC_MESSAGES/errors.po
index 51d016fe..e5677a7b 100644
--- a/priv/gettext/de/LC_MESSAGES/errors.po
+++ b/priv/gettext/de/LC_MESSAGES/errors.po
@@ -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"
diff --git a/priv/gettext/de/LC_MESSAGES/prompts.po b/priv/gettext/de/LC_MESSAGES/prompts.po
index 8cbf214e..a3693fff 100644
--- a/priv/gettext/de/LC_MESSAGES/prompts.po
+++ b/priv/gettext/de/LC_MESSAGES/prompts.po
@@ -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"
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot
index d10f946a..e1843a9f 100644
--- a/priv/gettext/default.pot
+++ b/priv/gettext/default.pot
@@ -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 ""
diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po
index 9163298e..1cf87773 100644
--- a/priv/gettext/en/LC_MESSAGES/default.po
+++ b/priv/gettext/en/LC_MESSAGES/default.po
@@ -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 ""
diff --git a/priv/gettext/en/LC_MESSAGES/errors.po b/priv/gettext/en/LC_MESSAGES/errors.po
index 30fec662..3cd1edcc 100644
--- a/priv/gettext/en/LC_MESSAGES/errors.po
+++ b/priv/gettext/en/LC_MESSAGES/errors.po
@@ -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 ""
diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po
index 8f87df10..ce7e70c5 100644
--- a/priv/gettext/en/LC_MESSAGES/prompts.po
+++ b/priv/gettext/en/LC_MESSAGES/prompts.po
@@ -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 ""
diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot
index 3d7f3d9e..f3e9244e 100644
--- a/priv/gettext/errors.pot
+++ b/priv/gettext/errors.pot
@@ -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 ""
diff --git a/priv/gettext/es/LC_MESSAGES/default.po b/priv/gettext/es/LC_MESSAGES/default.po
index c6bdab5a..ca98e5b6 100644
--- a/priv/gettext/es/LC_MESSAGES/default.po
+++ b/priv/gettext/es/LC_MESSAGES/default.po
@@ -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 ""
diff --git a/priv/gettext/es/LC_MESSAGES/errors.po b/priv/gettext/es/LC_MESSAGES/errors.po
index 29697b63..a215d3d5 100644
--- a/priv/gettext/es/LC_MESSAGES/errors.po
+++ b/priv/gettext/es/LC_MESSAGES/errors.po
@@ -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"
diff --git a/priv/gettext/es/LC_MESSAGES/prompts.po b/priv/gettext/es/LC_MESSAGES/prompts.po
index 25b92161..52a59e10 100644
--- a/priv/gettext/es/LC_MESSAGES/prompts.po
+++ b/priv/gettext/es/LC_MESSAGES/prompts.po
@@ -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}"
diff --git a/priv/gettext/fr/LC_MESSAGES/default.po b/priv/gettext/fr/LC_MESSAGES/default.po
index df9747e2..8ca27056 100644
--- a/priv/gettext/fr/LC_MESSAGES/default.po
+++ b/priv/gettext/fr/LC_MESSAGES/default.po
@@ -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 ""
diff --git a/priv/gettext/fr/LC_MESSAGES/errors.po b/priv/gettext/fr/LC_MESSAGES/errors.po
index f40d5b06..69ce2785 100644
--- a/priv/gettext/fr/LC_MESSAGES/errors.po
+++ b/priv/gettext/fr/LC_MESSAGES/errors.po
@@ -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"
diff --git a/priv/gettext/fr/LC_MESSAGES/prompts.po b/priv/gettext/fr/LC_MESSAGES/prompts.po
index 3784336e..81df77f8 100644
--- a/priv/gettext/fr/LC_MESSAGES/prompts.po
+++ b/priv/gettext/fr/LC_MESSAGES/prompts.po
@@ -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}"
diff --git a/priv/gettext/ga/LC_MESSAGES/default.po b/priv/gettext/ga/LC_MESSAGES/default.po
index 370940c3..ac45165d 100644
--- a/priv/gettext/ga/LC_MESSAGES/default.po
+++ b/priv/gettext/ga/LC_MESSAGES/default.po
@@ -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 ""
diff --git a/priv/gettext/ga/LC_MESSAGES/errors.po b/priv/gettext/ga/LC_MESSAGES/errors.po
index 50627d1f..12838c49 100644
--- a/priv/gettext/ga/LC_MESSAGES/errors.po
+++ b/priv/gettext/ga/LC_MESSAGES/errors.po
@@ -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"
diff --git a/priv/gettext/ga/LC_MESSAGES/prompts.po b/priv/gettext/ga/LC_MESSAGES/prompts.po
index f3c4b5bd..784e75e2 100644
--- a/priv/gettext/ga/LC_MESSAGES/prompts.po
+++ b/priv/gettext/ga/LC_MESSAGES/prompts.po
@@ -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 ""
diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot
index e68a9f7c..20a8c740 100644
--- a/priv/gettext/prompts.pot
+++ b/priv/gettext/prompts.pot
@@ -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 ""
diff --git a/test/cannery/containers_test.exs b/test/cannery/containers_test.exs
index 022e1a57..7b30ecb7 100644
--- a/test/cannery/containers_test.exs
+++ b/test/cannery/containers_test.exs
@@ -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) ==
diff --git a/test/cannery_web/live/container_live_test.exs b/test/cannery_web/live/container_live_test.exs
index cdfef106..536ec405 100644
--- a/test/cannery_web/live/container_live_test.exs
+++ b/test/cannery_web/live/container_live_test.exs
@@ -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"