add cloning to containers index

This commit is contained in:
shibao 2022-11-10 19:02:35 -05:00
parent 76d3554b4b
commit 0d6f6de7df
24 changed files with 260 additions and 111 deletions

View File

@ -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

View File

@ -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}} ->

View File

@ -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
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
patch={Routes.container_index_path(Endpoint, :clone, @container)}
class="text-primary-600 link"
data-qa={"clone-#{@container.id}"}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"

View File

@ -56,6 +56,14 @@
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
patch={Routes.container_index_path(Endpoint, :clone, container)}
class="text-primary-600 link"
data-qa={"clone-#{container.id}"}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"
@ -74,7 +82,7 @@
</div>
</div>
<%= 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}

View File

@ -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

View File

@ -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:"

View File

@ -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"

View File

@ -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

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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

View File

@ -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:"

View File

@ -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"

View File

@ -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

View File

@ -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 ""

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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))