diff --git a/CHANGELOG.md b/CHANGELOG.md
index 20008f76..4f9b367c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@
- Add graph to range page
- Add JSON export of data
- Add ammo cloning
+- Add container cloning
- Update project dependencies
# v0.5.4
diff --git a/lib/cannery_web/live/container_live/form_component.ex b/lib/cannery_web/live/container_live/form_component.ex
index a1c8418c..6b249d28 100644
--- a/lib/cannery_web/live/container_live/form_component.ex
+++ b/lib/cannery_web/live/container_live/form_component.ex
@@ -35,15 +35,18 @@ defmodule CanneryWeb.ContainerLive.FormComponent do
container_params
) do
changeset_action =
- case action do
- :new -> :insert
- :edit -> :update
+ cond do
+ action in [:new, :clone] -> :insert
+ action == :edit -> :update
end
changeset =
- case action do
- :new -> container |> Container.create_changeset(user, container_params)
- :edit -> container |> Container.update_changeset(container_params)
+ cond do
+ action in [:new, :clone] ->
+ container |> Container.create_changeset(user, container_params)
+
+ action == :edit ->
+ container |> Container.update_changeset(container_params)
end
changeset =
@@ -76,9 +79,10 @@ defmodule CanneryWeb.ContainerLive.FormComponent do
defp save_container(
%{assigns: %{current_user: current_user, return_to: return_to}} = socket,
- :new,
+ action,
container_params
- ) do
+ )
+ when action in [:new, :clone] do
socket =
case Containers.create_container(container_params, current_user) do
{:ok, %{name: container_name}} ->
diff --git a/lib/cannery_web/live/container_live/index.ex b/lib/cannery_web/live/container_live/index.ex
index 2e6374b5..ebd3f19f 100644
--- a/lib/cannery_web/live/container_live/index.ex
+++ b/lib/cannery_web/live/container_live/index.ex
@@ -31,6 +31,13 @@ defmodule CanneryWeb.ContainerLive.Index do
socket |> assign(:page_title, gettext("New Container")) |> assign(:container, %Container{})
end
+ defp apply_action(%{assigns: %{current_user: current_user}} = socket, :clone, %{"id" => id}) do
+ container = Containers.get_container!(id, current_user)
+
+ socket
+ |> assign(page_title: gettext("New Container"), container: %{container | id: nil})
+ end
+
defp apply_action(socket, :index, _params) do
socket
|> assign(
@@ -199,6 +206,14 @@ defmodule CanneryWeb.ContainerLive.Index do
+ <.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"
diff --git a/lib/cannery_web/live/container_live/index.html.heex b/lib/cannery_web/live/container_live/index.html.heex
index 45c9723e..8be7ca46 100644
--- a/lib/cannery_web/live/container_live/index.html.heex
+++ b/lib/cannery_web/live/container_live/index.html.heex
@@ -56,6 +56,14 @@
+ <.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"
@@ -74,7 +82,7 @@
-<%= if @live_action in [:new, :edit] do %>
+<%= if @live_action in [:new, :edit, :clone] do %>
<.modal return_to={return_to(@view_table)}>
<.live_component
module={CanneryWeb.ContainerLive.FormComponent}
diff --git a/lib/cannery_web/router.ex b/lib/cannery_web/router.ex
index bb053cdd..84153a21 100644
--- a/lib/cannery_web/router.ex
+++ b/lib/cannery_web/router.ex
@@ -77,6 +77,7 @@ defmodule CanneryWeb.Router do
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/:id", ContainerLive.Show, :show
diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po
index 999e4e3f..96dc4dfd 100644
--- a/priv/gettext/de/LC_MESSAGES/default.po
+++ b/priv/gettext/de/LC_MESSAGES/default.po
@@ -124,8 +124,8 @@ msgid "Container"
msgstr "Behälter"
#: lib/cannery_web/components/topbar.ex:57
-#: lib/cannery_web/live/container_live/index.ex:37
-#: lib/cannery_web/live/container_live/index.ex:46
+#: 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.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@@ -152,7 +152,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:115
+#: lib/cannery_web/live/container_live/index.ex:122
#, elixir-autogen, elixir-format
msgid "Description"
msgstr "Beschreibung"
@@ -242,7 +242,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:116
+#: lib/cannery_web/live/container_live/index.ex:123
#, elixir-autogen, elixir-format
msgid "Location"
msgstr "Standort"
@@ -278,7 +278,7 @@ msgstr "Meine coole Munitionskiste"
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/ammo_type_live/index.ex:51
#: lib/cannery_web/live/container_live/form_component.html.heex:20
-#: lib/cannery_web/live/container_live/index.ex:114
+#: lib/cannery_web/live/container_live/index.ex:121
#: 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
@@ -291,6 +291,7 @@ 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
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr "Neuer Behälter"
@@ -425,7 +426,7 @@ msgid "Stored in"
msgstr "Gelagert in"
#: lib/cannery_web/components/topbar.ex:49
-#: lib/cannery_web/live/container_live/index.ex:120
+#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@@ -456,7 +457,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:117
+#: lib/cannery_web/live/container_live/index.ex:124
#, elixir-autogen, elixir-format
msgid "Type"
msgstr "Art"
@@ -692,7 +693,7 @@ msgstr "Lädt..."
msgid "Edit %{name}"
msgstr "%{name} bearbeiten"
-#: lib/cannery_web/live/container_live/index.ex:58
+#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:107
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
@@ -971,12 +972,12 @@ msgstr ""
msgid "Rounds shot: %{count}"
msgstr "Patronen abgefeuert"
-#: lib/cannery_web/live/container_live/index.ex:118
+#: lib/cannery_web/live/container_live/index.ex:125
#, elixir-autogen, elixir-format, fuzzy
msgid "Packs"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:119
+#: lib/cannery_web/live/container_live/index.ex:126
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds"
msgstr "Patronen:"
diff --git a/priv/gettext/de/LC_MESSAGES/errors.po b/priv/gettext/de/LC_MESSAGES/errors.po
index eae21de4..c46e305f 100644
--- a/priv/gettext/de/LC_MESSAGES/errors.po
+++ b/priv/gettext/de/LC_MESSAGES/errors.po
@@ -28,13 +28,13 @@ msgstr ""
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:81
+#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:71
#, 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:69
+#: lib/cannery_web/live/container_live/index.ex:76
#, 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 f9e29ce0..0856c0ab 100644
--- a/priv/gettext/de/LC_MESSAGES/prompts.po
+++ b/priv/gettext/de/LC_MESSAGES/prompts.po
@@ -24,7 +24,7 @@ msgstr ""
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
-#: lib/cannery_web/live/container_live/form_component.ex:85
+#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:126
#, elixir-autogen, elixir-format
@@ -50,7 +50,7 @@ msgstr "%{name} erfolgreich deaktiviert"
msgid "%{name} enabled succesfully"
msgstr "%{name} erfolgreich aktiviert"
-#: lib/cannery_web/live/container_live/index.ex:74
+#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:61
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
@@ -62,7 +62,7 @@ msgid "%{name} updated succesfully"
msgstr "%{name} erfolgreich aktualisiert"
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
-#: lib/cannery_web/live/container_live/form_component.ex:67
+#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:108
#, elixir-autogen, elixir-format
@@ -87,8 +87,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:208
-#: lib/cannery_web/live/container_live/index.html.heex:65
+#: lib/cannery_web/live/container_live/index.ex:223
+#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/show.html.heex:51
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot
index 04afe3bb..9fd1d66b 100644
--- a/priv/gettext/default.pot
+++ b/priv/gettext/default.pot
@@ -109,8 +109,8 @@ msgid "Container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:57
-#: lib/cannery_web/live/container_live/index.ex:37
-#: lib/cannery_web/live/container_live/index.ex:46
+#: 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.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:115
+#: lib/cannery_web/live/container_live/index.ex:122
#, elixir-autogen, elixir-format
msgid "Description"
msgstr ""
@@ -227,7 +227,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:116
+#: lib/cannery_web/live/container_live/index.ex:123
#, elixir-autogen, elixir-format
msgid "Location"
msgstr ""
@@ -263,7 +263,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/ammo_type_live/index.ex:51
#: lib/cannery_web/live/container_live/form_component.html.heex:20
-#: lib/cannery_web/live/container_live/index.ex:114
+#: lib/cannery_web/live/container_live/index.ex:121
#: 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
@@ -276,6 +276,7 @@ msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:31
+#: lib/cannery_web/live/container_live/index.ex:38
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr ""
@@ -408,7 +409,7 @@ msgid "Stored in"
msgstr ""
#: lib/cannery_web/components/topbar.ex:49
-#: lib/cannery_web/live/container_live/index.ex:120
+#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@@ -439,7 +440,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:117
+#: lib/cannery_web/live/container_live/index.ex:124
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@@ -675,7 +676,7 @@ msgstr ""
msgid "Edit %{name}"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:58
+#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:107
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
@@ -954,12 +955,12 @@ msgstr ""
msgid "Rounds shot: %{count}"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:118
+#: lib/cannery_web/live/container_live/index.ex:125
#, elixir-autogen, elixir-format
msgid "Packs"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:119
+#: lib/cannery_web/live/container_live/index.ex:126
#, elixir-autogen, elixir-format
msgid "Rounds"
msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po
index df30bd68..1f89e2c1 100644
--- a/priv/gettext/en/LC_MESSAGES/default.po
+++ b/priv/gettext/en/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:37
-#: lib/cannery_web/live/container_live/index.ex:46
+#: 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.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@@ -138,7 +138,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:115
+#: lib/cannery_web/live/container_live/index.ex:122
#, elixir-autogen, elixir-format
msgid "Description"
msgstr ""
@@ -228,7 +228,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:116
+#: lib/cannery_web/live/container_live/index.ex:123
#, elixir-autogen, elixir-format
msgid "Location"
msgstr ""
@@ -264,7 +264,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/ammo_type_live/index.ex:51
#: lib/cannery_web/live/container_live/form_component.html.heex:20
-#: lib/cannery_web/live/container_live/index.ex:114
+#: lib/cannery_web/live/container_live/index.ex:121
#: 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
@@ -277,6 +277,7 @@ msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:31
+#: lib/cannery_web/live/container_live/index.ex:38
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr ""
@@ -409,7 +410,7 @@ msgid "Stored in"
msgstr ""
#: lib/cannery_web/components/topbar.ex:49
-#: lib/cannery_web/live/container_live/index.ex:120
+#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@@ -440,7 +441,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:117
+#: lib/cannery_web/live/container_live/index.ex:124
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@@ -676,7 +677,7 @@ msgstr ""
msgid "Edit %{name}"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:58
+#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:107
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
@@ -955,12 +956,12 @@ msgstr ""
msgid "Rounds shot: %{count}"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:118
+#: lib/cannery_web/live/container_live/index.ex:125
#, elixir-autogen, elixir-format, fuzzy
msgid "Packs"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:119
+#: lib/cannery_web/live/container_live/index.ex:126
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds"
msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/errors.po b/priv/gettext/en/LC_MESSAGES/errors.po
index c5aa1418..25fd61f6 100644
--- a/priv/gettext/en/LC_MESSAGES/errors.po
+++ b/priv/gettext/en/LC_MESSAGES/errors.po
@@ -15,13 +15,13 @@ msgstr ""
msgid "Container must be empty before deleting"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:81
+#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:71
#, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:69
+#: lib/cannery_web/live/container_live/index.ex:76
#, 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 1a981e62..cb681248 100644
--- a/priv/gettext/en/LC_MESSAGES/prompts.po
+++ b/priv/gettext/en/LC_MESSAGES/prompts.po
@@ -12,7 +12,7 @@ msgstr ""
"Plural-Forms: nplurals=2\n"
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
-#: lib/cannery_web/live/container_live/form_component.ex:85
+#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:126
#, elixir-autogen, elixir-format
@@ -38,7 +38,7 @@ msgstr ""
msgid "%{name} enabled succesfully"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:74
+#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:61
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
@@ -50,7 +50,7 @@ msgid "%{name} updated succesfully"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
-#: lib/cannery_web/live/container_live/form_component.ex:67
+#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:108
#, elixir-autogen, elixir-format
@@ -73,8 +73,8 @@ msgstr ""
msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:208
-#: lib/cannery_web/live/container_live/index.html.heex:65
+#: lib/cannery_web/live/container_live/index.ex:223
+#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/show.html.heex:51
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot
index 7bfc04ef..badbb267 100644
--- a/priv/gettext/errors.pot
+++ b/priv/gettext/errors.pot
@@ -15,13 +15,13 @@ msgstr ""
msgid "Container must be empty before deleting"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:81
+#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:71
#, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:69
+#: lib/cannery_web/live/container_live/index.ex:76
#, 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 6a736a30..b138195e 100644
--- a/priv/gettext/es/LC_MESSAGES/default.po
+++ b/priv/gettext/es/LC_MESSAGES/default.po
@@ -124,8 +124,8 @@ msgid "Container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:57
-#: lib/cannery_web/live/container_live/index.ex:37
-#: lib/cannery_web/live/container_live/index.ex:46
+#: 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.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@@ -152,7 +152,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:115
+#: lib/cannery_web/live/container_live/index.ex:122
#, elixir-autogen, elixir-format
msgid "Description"
msgstr ""
@@ -242,7 +242,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:116
+#: lib/cannery_web/live/container_live/index.ex:123
#, elixir-autogen, elixir-format
msgid "Location"
msgstr ""
@@ -278,7 +278,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/ammo_type_live/index.ex:51
#: lib/cannery_web/live/container_live/form_component.html.heex:20
-#: lib/cannery_web/live/container_live/index.ex:114
+#: lib/cannery_web/live/container_live/index.ex:121
#: 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
@@ -291,6 +291,7 @@ msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:31
+#: lib/cannery_web/live/container_live/index.ex:38
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr ""
@@ -423,7 +424,7 @@ msgid "Stored in"
msgstr ""
#: lib/cannery_web/components/topbar.ex:49
-#: lib/cannery_web/live/container_live/index.ex:120
+#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@@ -454,7 +455,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:117
+#: lib/cannery_web/live/container_live/index.ex:124
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@@ -690,7 +691,7 @@ msgstr ""
msgid "Edit %{name}"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:58
+#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:107
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
@@ -969,12 +970,12 @@ msgstr ""
msgid "Rounds shot: %{count}"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:118
+#: lib/cannery_web/live/container_live/index.ex:125
#, elixir-autogen, elixir-format, fuzzy
msgid "Packs"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:119
+#: lib/cannery_web/live/container_live/index.ex:126
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds"
msgstr ""
diff --git a/priv/gettext/es/LC_MESSAGES/errors.po b/priv/gettext/es/LC_MESSAGES/errors.po
index a882037d..d398e331 100644
--- a/priv/gettext/es/LC_MESSAGES/errors.po
+++ b/priv/gettext/es/LC_MESSAGES/errors.po
@@ -28,13 +28,13 @@ msgstr ""
msgid "Container must be empty before deleting"
msgstr "el Contenedor debe estar vació antes de borrarlo"
-#: lib/cannery_web/live/container_live/index.ex:81
+#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:71
#, 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:69
+#: lib/cannery_web/live/container_live/index.ex:76
#, elixir-autogen, elixir-format
msgid "Could not find that container"
msgstr ""
diff --git a/priv/gettext/es/LC_MESSAGES/prompts.po b/priv/gettext/es/LC_MESSAGES/prompts.po
index cc0c0740..b66966ba 100644
--- a/priv/gettext/es/LC_MESSAGES/prompts.po
+++ b/priv/gettext/es/LC_MESSAGES/prompts.po
@@ -24,7 +24,7 @@ msgstr ""
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
-#: lib/cannery_web/live/container_live/form_component.ex:85
+#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:126
#, elixir-autogen, elixir-format
@@ -50,7 +50,7 @@ msgstr "%{name} desactivado exitosamente"
msgid "%{name} enabled succesfully"
msgstr "%{name} activado exitosamente"
-#: lib/cannery_web/live/container_live/index.ex:74
+#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:61
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
@@ -62,7 +62,7 @@ msgid "%{name} updated succesfully"
msgstr "%{name} actualizado exitosamente"
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
-#: lib/cannery_web/live/container_live/form_component.ex:67
+#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:108
#, elixir-autogen, elixir-format
@@ -87,8 +87,8 @@ msgstr "Grupo de Munición borrado exitosamente"
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:208
-#: lib/cannery_web/live/container_live/index.html.heex:65
+#: lib/cannery_web/live/container_live/index.ex:223
+#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/show.html.heex:51
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/fr/LC_MESSAGES/default.po b/priv/gettext/fr/LC_MESSAGES/default.po
index 253517a7..154a2378 100644
--- a/priv/gettext/fr/LC_MESSAGES/default.po
+++ b/priv/gettext/fr/LC_MESSAGES/default.po
@@ -124,8 +124,8 @@ msgid "Container"
msgstr "Conteneur"
#: lib/cannery_web/components/topbar.ex:57
-#: lib/cannery_web/live/container_live/index.ex:37
-#: lib/cannery_web/live/container_live/index.ex:46
+#: 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.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@@ -152,7 +152,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:115
+#: lib/cannery_web/live/container_live/index.ex:122
#, elixir-autogen, elixir-format
msgid "Description"
msgstr "Description"
@@ -242,7 +242,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:116
+#: lib/cannery_web/live/container_live/index.ex:123
#, elixir-autogen, elixir-format
msgid "Location"
msgstr "Localisation"
@@ -278,7 +278,7 @@ msgstr "Ma superbe boite de munition"
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/ammo_type_live/index.ex:51
#: lib/cannery_web/live/container_live/form_component.html.heex:20
-#: lib/cannery_web/live/container_live/index.ex:114
+#: lib/cannery_web/live/container_live/index.ex:121
#: 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
@@ -291,6 +291,7 @@ 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
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr "Nouveau conteneur"
@@ -425,7 +426,7 @@ msgid "Stored in"
msgstr "Est stocké dans"
#: lib/cannery_web/components/topbar.ex:49
-#: lib/cannery_web/live/container_live/index.ex:120
+#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@@ -458,7 +459,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:117
+#: lib/cannery_web/live/container_live/index.ex:124
#, elixir-autogen, elixir-format
msgid "Type"
msgstr "Type"
@@ -694,7 +695,7 @@ msgstr "Chargement en cours…"
msgid "Edit %{name}"
msgstr "Éditer %{name}"
-#: lib/cannery_web/live/container_live/index.ex:58
+#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:107
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
@@ -974,12 +975,12 @@ msgstr ""
msgid "Rounds shot: %{count}"
msgstr "Cartouches tirées"
-#: lib/cannery_web/live/container_live/index.ex:118
+#: lib/cannery_web/live/container_live/index.ex:125
#, elixir-autogen, elixir-format, fuzzy
msgid "Packs"
msgstr "Packages :"
-#: lib/cannery_web/live/container_live/index.ex:119
+#: lib/cannery_web/live/container_live/index.ex:126
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds"
msgstr "Cartouches :"
diff --git a/priv/gettext/fr/LC_MESSAGES/errors.po b/priv/gettext/fr/LC_MESSAGES/errors.po
index af8a8ecf..96fcdee1 100644
--- a/priv/gettext/fr/LC_MESSAGES/errors.po
+++ b/priv/gettext/fr/LC_MESSAGES/errors.po
@@ -28,13 +28,13 @@ msgstr ""
msgid "Container must be empty before deleting"
msgstr "Le conteneur doit être vide pour être supprimé"
-#: lib/cannery_web/live/container_live/index.ex:81
+#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:71
#, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}"
msgstr "Impossible de supprimer %{name} : %{error}"
-#: lib/cannery_web/live/container_live/index.ex:69
+#: lib/cannery_web/live/container_live/index.ex:76
#, 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 b06b9147..3a2ea170 100644
--- a/priv/gettext/fr/LC_MESSAGES/prompts.po
+++ b/priv/gettext/fr/LC_MESSAGES/prompts.po
@@ -24,7 +24,7 @@ msgstr ""
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
-#: lib/cannery_web/live/container_live/form_component.ex:85
+#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:126
#, elixir-autogen, elixir-format
@@ -50,7 +50,7 @@ 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:74
+#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:61
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
@@ -62,7 +62,7 @@ msgid "%{name} updated succesfully"
msgstr "%{name} mis à jour avec succès"
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
-#: lib/cannery_web/live/container_live/form_component.ex:67
+#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:108
#, elixir-autogen, elixir-format
@@ -88,8 +88,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:208
-#: lib/cannery_web/live/container_live/index.html.heex:65
+#: lib/cannery_web/live/container_live/index.ex:223
+#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/show.html.heex:51
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/ga/LC_MESSAGES/default.po b/priv/gettext/ga/LC_MESSAGES/default.po
index 5a33ffdc..6ed302f7 100644
--- a/priv/gettext/ga/LC_MESSAGES/default.po
+++ b/priv/gettext/ga/LC_MESSAGES/default.po
@@ -120,8 +120,8 @@ msgid "Container"
msgstr ""
#: lib/cannery_web/components/topbar.ex:57
-#: lib/cannery_web/live/container_live/index.ex:37
-#: lib/cannery_web/live/container_live/index.ex:46
+#: 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.html.heex:3
#, elixir-autogen, elixir-format
msgid "Containers"
@@ -148,7 +148,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:115
+#: lib/cannery_web/live/container_live/index.ex:122
#, elixir-autogen, elixir-format
msgid "Description"
msgstr ""
@@ -238,7 +238,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:116
+#: lib/cannery_web/live/container_live/index.ex:123
#, elixir-autogen, elixir-format
msgid "Location"
msgstr ""
@@ -274,7 +274,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:20
#: lib/cannery_web/live/ammo_type_live/index.ex:51
#: lib/cannery_web/live/container_live/form_component.html.heex:20
-#: lib/cannery_web/live/container_live/index.ex:114
+#: lib/cannery_web/live/container_live/index.ex:121
#: 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
@@ -287,6 +287,7 @@ msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:31
+#: lib/cannery_web/live/container_live/index.ex:38
#, elixir-autogen, elixir-format
msgid "New Container"
msgstr ""
@@ -419,7 +420,7 @@ msgid "Stored in"
msgstr ""
#: lib/cannery_web/components/topbar.ex:49
-#: lib/cannery_web/live/container_live/index.ex:120
+#: lib/cannery_web/live/container_live/index.ex:127
#: lib/cannery_web/live/tag_live/index.ex:32
#: lib/cannery_web/live/tag_live/index.html.heex:3
#, elixir-autogen, elixir-format
@@ -450,7 +451,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:117
+#: lib/cannery_web/live/container_live/index.ex:124
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@@ -686,7 +687,7 @@ msgstr ""
msgid "Edit %{name}"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:58
+#: lib/cannery_web/live/container_live/index.ex:65
#: lib/cannery_web/live/container_live/show.ex:107
#, elixir-autogen, elixir-format
msgid "Edit %{name} tags"
@@ -965,12 +966,12 @@ msgstr ""
msgid "Rounds shot: %{count}"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:118
+#: lib/cannery_web/live/container_live/index.ex:125
#, elixir-autogen, elixir-format, fuzzy
msgid "Packs"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:119
+#: lib/cannery_web/live/container_live/index.ex:126
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds"
msgstr ""
diff --git a/priv/gettext/ga/LC_MESSAGES/errors.po b/priv/gettext/ga/LC_MESSAGES/errors.po
index 06502ad2..a3228768 100644
--- a/priv/gettext/ga/LC_MESSAGES/errors.po
+++ b/priv/gettext/ga/LC_MESSAGES/errors.po
@@ -29,13 +29,13 @@ msgstr ""
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:81
+#: lib/cannery_web/live/container_live/index.ex:88
#: lib/cannery_web/live/container_live/show.ex:71
#, 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:69
+#: lib/cannery_web/live/container_live/index.ex:76
#, 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 34816806..98fe7be0 100644
--- a/priv/gettext/ga/LC_MESSAGES/prompts.po
+++ b/priv/gettext/ga/LC_MESSAGES/prompts.po
@@ -22,7 +22,7 @@ msgstr ""
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
-#: lib/cannery_web/live/container_live/form_component.ex:85
+#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:126
#, elixir-autogen, elixir-format
@@ -48,7 +48,7 @@ msgstr ""
msgid "%{name} enabled succesfully"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:74
+#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:61
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
@@ -60,7 +60,7 @@ msgid "%{name} updated succesfully"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
-#: lib/cannery_web/live/container_live/form_component.ex:67
+#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:108
#, elixir-autogen, elixir-format
@@ -83,8 +83,8 @@ msgstr ""
msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:208
-#: lib/cannery_web/live/container_live/index.html.heex:65
+#: lib/cannery_web/live/container_live/index.ex:223
+#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/show.html.heex:51
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot
index b44d67e4..b8bfddd5 100644
--- a/priv/gettext/prompts.pot
+++ b/priv/gettext/prompts.pot
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
-#: lib/cannery_web/live/container_live/form_component.ex:85
+#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:126
#, elixir-autogen, elixir-format
@@ -37,7 +37,7 @@ msgstr ""
msgid "%{name} enabled succesfully"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:74
+#: lib/cannery_web/live/container_live/index.ex:81
#: lib/cannery_web/live/container_live/show.ex:61
#, elixir-autogen, elixir-format
msgid "%{name} has been deleted"
@@ -49,7 +49,7 @@ msgid "%{name} updated succesfully"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
-#: lib/cannery_web/live/container_live/form_component.ex:67
+#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:108
#, elixir-autogen, elixir-format
@@ -72,8 +72,8 @@ msgstr ""
msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr ""
-#: lib/cannery_web/live/container_live/index.ex:208
-#: lib/cannery_web/live/container_live/index.html.heex:65
+#: lib/cannery_web/live/container_live/index.ex:223
+#: lib/cannery_web/live/container_live/index.html.heex:73
#: lib/cannery_web/live/container_live/show.html.heex:51
#: lib/cannery_web/live/tag_live/index.html.heex:39
#, elixir-autogen, elixir-format
diff --git a/test/cannery_web/live/container_live_test.exs b/test/cannery_web/live/container_live_test.exs
index 721bcae1..f5be2994 100644
--- a/test/cannery_web/live/container_live_test.exs
+++ b/test/cannery_web/live/container_live_test.exs
@@ -114,6 +114,63 @@ defmodule CanneryWeb.ContainerLiveTest do
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))
@@ -181,6 +238,63 @@ defmodule CanneryWeb.ContainerLiveTest do
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, :table))