forked from shibao/cannery
use changeset helper
This commit is contained in:
parent
3593334c85
commit
6c09261368
@ -191,22 +191,6 @@ defmodule Cannery.Ammo do
|
|||||||
def delete_ammo_type!(%AmmoType{user_id: user_id} = ammo_type, %User{id: user_id}),
|
def delete_ammo_type!(%AmmoType{user_id: user_id} = ammo_type, %User{id: user_id}),
|
||||||
do: ammo_type |> Repo.delete!()
|
do: ammo_type |> Repo.delete!()
|
||||||
|
|
||||||
@doc """
|
|
||||||
Returns an `%Changeset{}` for tracking ammo_type changes.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
iex> change_ammo_type(ammo_type)
|
|
||||||
%Changeset{data: %AmmoType{}}
|
|
||||||
|
|
||||||
"""
|
|
||||||
@spec change_ammo_type(AmmoType.t() | AmmoType.new_ammo_type()) ::
|
|
||||||
Changeset.t(AmmoType.t() | AmmoType.new_ammo_type())
|
|
||||||
@spec change_ammo_type(AmmoType.t() | AmmoType.new_ammo_type(), attrs :: map()) ::
|
|
||||||
Changeset.t(AmmoType.t() | AmmoType.new_ammo_type())
|
|
||||||
def change_ammo_type(%AmmoType{} = ammo_type, attrs \\ %{}),
|
|
||||||
do: AmmoType.update_changeset(ammo_type, attrs)
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of ammo_groups for a user and type.
|
Returns the list of ammo_groups for a user and type.
|
||||||
|
|
||||||
|
@ -21,11 +21,11 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@spec update(Socket.t()) :: {:ok, Socket.t()}
|
@spec update(Socket.t()) :: {:ok, Socket.t()}
|
||||||
def update(%{assigns: %{ammo_group: ammo_group, current_user: current_user}} = socket) do
|
def update(%{assigns: %{current_user: current_user}} = socket) do
|
||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> assign(:ammo_group_create_limit, @ammo_group_create_limit)
|
|> assign(:ammo_group_create_limit, @ammo_group_create_limit)
|
||||||
|> assign(:changeset, ammo_group |> AmmoGroup.update_changeset(%{}))
|
|> assign_changeset(%{})
|
||||||
|> assign(:ammo_types, Ammo.list_ammo_types(current_user))
|
|> assign(:ammo_types, Ammo.list_ammo_types(current_user))
|
||||||
|> assign_new(:containers, fn -> Containers.list_containers(current_user) end)
|
|> assign_new(:containers, fn -> Containers.list_containers(current_user) end)
|
||||||
|
|
||||||
@ -33,11 +33,35 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
def handle_event("validate", %{"ammo_group" => ammo_group_params}, socket) do
|
||||||
|
{:noreply, socket |> assign_changeset(ammo_group_params)}
|
||||||
|
end
|
||||||
|
|
||||||
def handle_event(
|
def handle_event(
|
||||||
"validate",
|
"save",
|
||||||
%{"ammo_group" => ammo_group_params},
|
%{"ammo_group" => ammo_group_params},
|
||||||
%{assigns: %{action: action, ammo_group: ammo_group, current_user: user}} = socket
|
%{assigns: %{action: action}} = socket
|
||||||
) do
|
) do
|
||||||
|
save_ammo_group(socket, action, ammo_group_params)
|
||||||
|
end
|
||||||
|
|
||||||
|
# HTML Helpers
|
||||||
|
@spec container_options([Container.t()]) :: [{String.t(), Container.id()}]
|
||||||
|
defp container_options(containers) do
|
||||||
|
containers |> Enum.map(fn %{id: id, name: name} -> {name, id} end)
|
||||||
|
end
|
||||||
|
|
||||||
|
@spec ammo_type_options([AmmoType.t()]) :: [{String.t(), AmmoType.id()}]
|
||||||
|
defp ammo_type_options(ammo_types) do
|
||||||
|
ammo_types |> Enum.map(fn %{id: id, name: name} -> {name, id} end)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Save Helpers
|
||||||
|
|
||||||
|
defp assign_changeset(
|
||||||
|
%{assigns: %{action: action, ammo_group: ammo_group, current_user: user}} = socket,
|
||||||
|
ammo_group_params
|
||||||
|
) do
|
||||||
changeset_action =
|
changeset_action =
|
||||||
case action do
|
case action do
|
||||||
:new -> :insert
|
:new -> :insert
|
||||||
@ -69,30 +93,9 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
|
|||||||
{:error, changeset} -> changeset
|
{:error, changeset} -> changeset
|
||||||
end
|
end
|
||||||
|
|
||||||
{:noreply, socket |> assign(:changeset, changeset)}
|
socket |> assign(:changeset, changeset)
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_event(
|
|
||||||
"save",
|
|
||||||
%{"ammo_group" => ammo_group_params},
|
|
||||||
%{assigns: %{action: action}} = socket
|
|
||||||
) do
|
|
||||||
save_ammo_group(socket, action, ammo_group_params)
|
|
||||||
end
|
|
||||||
|
|
||||||
# HTML Helpers
|
|
||||||
@spec container_options([Container.t()]) :: [{String.t(), Container.id()}]
|
|
||||||
defp container_options(containers) do
|
|
||||||
containers |> Enum.map(fn %{id: id, name: name} -> {name, id} end)
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec ammo_type_options([AmmoType.t()]) :: [{String.t(), AmmoType.id()}]
|
|
||||||
defp ammo_type_options(ammo_types) do
|
|
||||||
ammo_types |> Enum.map(fn %{id: id, name: name} -> {name, id} end)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Save Helpers
|
|
||||||
|
|
||||||
defp save_ammo_group(
|
defp save_ammo_group(
|
||||||
%{assigns: %{ammo_group: ammo_group, current_user: current_user, return_to: return_to}} =
|
%{assigns: %{ammo_group: ammo_group, current_user: current_user, return_to: return_to}} =
|
||||||
socket,
|
socket,
|
||||||
|
@ -13,17 +13,13 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
|
|||||||
%{:ammo_type => AmmoType.t(), :current_user => User.t(), optional(any) => any},
|
%{:ammo_type => AmmoType.t(), :current_user => User.t(), optional(any) => any},
|
||||||
Socket.t()
|
Socket.t()
|
||||||
) :: {:ok, Socket.t()}
|
) :: {:ok, Socket.t()}
|
||||||
def update(%{ammo_type: ammo_type, current_user: _current_user} = assigns, socket) do
|
def update(%{current_user: _current_user} = assigns, socket) do
|
||||||
{:ok, socket |> assign(assigns) |> assign(:changeset, Ammo.change_ammo_type(ammo_type))}
|
{:ok, socket |> assign(assigns) |> assign_changeset(%{})}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_event(
|
def handle_event("validate", %{"ammo_type" => ammo_type_params}, socket) do
|
||||||
"validate",
|
{:noreply, socket |> assign_changeset(ammo_type_params)}
|
||||||
%{"ammo_type" => ammo_type_params},
|
|
||||||
%{assigns: %{ammo_type: ammo_type}} = socket
|
|
||||||
) do
|
|
||||||
{:noreply, socket |> assign(:changeset, ammo_type |> Ammo.change_ammo_type(ammo_type_params))}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_event(
|
def handle_event(
|
||||||
@ -34,6 +30,31 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
|
|||||||
save_ammo_type(socket, action, ammo_type_params)
|
save_ammo_type(socket, action, ammo_type_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp assign_changeset(
|
||||||
|
%{assigns: %{action: action, ammo_type: ammo_type, current_user: user}} = socket,
|
||||||
|
ammo_type_params
|
||||||
|
) do
|
||||||
|
changeset_action =
|
||||||
|
case action do
|
||||||
|
:new -> :insert
|
||||||
|
:edit -> :update
|
||||||
|
end
|
||||||
|
|
||||||
|
changeset =
|
||||||
|
case action do
|
||||||
|
:new -> ammo_type |> AmmoType.create_changeset(user, ammo_type_params)
|
||||||
|
:edit -> ammo_type |> AmmoType.update_changeset(ammo_type_params)
|
||||||
|
end
|
||||||
|
|
||||||
|
changeset =
|
||||||
|
case changeset |> Changeset.apply_action(changeset_action) do
|
||||||
|
{:ok, _data} -> changeset
|
||||||
|
{:error, changeset} -> changeset
|
||||||
|
end
|
||||||
|
|
||||||
|
socket |> assign(changeset: changeset)
|
||||||
|
end
|
||||||
|
|
||||||
defp save_ammo_type(
|
defp save_ammo_type(
|
||||||
%{assigns: %{ammo_type: ammo_type, current_user: current_user, return_to: return_to}} =
|
%{assigns: %{ammo_type: ammo_type, current_user: current_user, return_to: return_to}} =
|
||||||
socket,
|
socket,
|
||||||
|
@ -176,19 +176,19 @@ msgid "Tag could not be removed"
|
|||||||
msgstr "Tag konnte nicht gelöscht werden"
|
msgstr "Tag konnte nicht gelöscht werden"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:143
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:146
|
||||||
msgid "Could not parse number of copies"
|
msgid "Could not parse number of copies"
|
||||||
msgstr "Konnte die Anzahl der Kopien nicht verstehen"
|
msgstr "Konnte die Anzahl der Kopien nicht verstehen"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:128
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:131
|
||||||
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
|
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Ungültige Nummer an Kopien. Muss zwischen 1 and %{max} liegen. War "
|
"Ungültige Nummer an Kopien. Muss zwischen 1 and %{max} liegen. War "
|
||||||
"%{multiplier}"
|
"%{multiplier}"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery/ammo.ex:404
|
#: lib/cannery/ammo.ex:388
|
||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ msgstr ""
|
|||||||
## date. Leave "msgstr"s empty as changing them here has no
|
## date. Leave "msgstr"s empty as changing them here has no
|
||||||
## effect: edit them in PO (.po) files instead.
|
## effect: edit them in PO (.po) files instead.
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_type_live/form_component.ex:64
|
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
|
||||||
#: lib/cannery_web/live/container_live/form_component.ex:66
|
#: lib/cannery_web/live/container_live/form_component.ex:66
|
||||||
#: lib/cannery_web/live/invite_live/form_component.ex:59
|
#: lib/cannery_web/live/invite_live/form_component.ex:59
|
||||||
#: lib/cannery_web/live/tag_live/form_component.ex:101
|
#: lib/cannery_web/live/tag_live/form_component.ex:101
|
||||||
@ -62,7 +62,7 @@ msgid "%{name} updated succesfully"
|
|||||||
msgstr "%{name} erfolgreich aktualisiert"
|
msgstr "%{name} erfolgreich aktualisiert"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_type_live/form_component.ex:46
|
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
|
||||||
#: lib/cannery_web/live/container_live/form_component.ex:48
|
#: lib/cannery_web/live/container_live/form_component.ex:48
|
||||||
#: lib/cannery_web/live/invite_live/form_component.ex:41
|
#: lib/cannery_web/live/invite_live/form_component.ex:41
|
||||||
#: lib/cannery_web/live/tag_live/form_component.ex:83
|
#: lib/cannery_web/live/tag_live/form_component.ex:83
|
||||||
@ -283,12 +283,12 @@ msgid "Ammo unstaged succesfully"
|
|||||||
msgstr "Munition erfolgreich demarkiert"
|
msgstr "Munition erfolgreich demarkiert"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:105
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:108
|
||||||
msgid "Ammo updated successfully"
|
msgid "Ammo updated successfully"
|
||||||
msgstr "Munitionsgruppe erfolgreich aktualisiert"
|
msgstr "Munitionsgruppe erfolgreich aktualisiert"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:164
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:167
|
||||||
msgid "Ammo added successfully"
|
msgid "Ammo added successfully"
|
||||||
msgid_plural "Ammo added successfully"
|
msgid_plural "Ammo added successfully"
|
||||||
msgstr[0] "Munitionsgruppe erfolgreich aktualisiert"
|
msgstr[0] "Munitionsgruppe erfolgreich aktualisiert"
|
||||||
|
@ -161,17 +161,17 @@ msgid "Tag could not be removed"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:143
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:146
|
||||||
msgid "Could not parse number of copies"
|
msgid "Could not parse number of copies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:128
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:131
|
||||||
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
|
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery/ammo.ex:404
|
#: lib/cannery/ammo.ex:388
|
||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ msgstr ""
|
|||||||
"Plural-Forms: nplurals=2\n"
|
"Plural-Forms: nplurals=2\n"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_type_live/form_component.ex:64
|
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
|
||||||
#: lib/cannery_web/live/container_live/form_component.ex:66
|
#: lib/cannery_web/live/container_live/form_component.ex:66
|
||||||
#: lib/cannery_web/live/invite_live/form_component.ex:59
|
#: lib/cannery_web/live/invite_live/form_component.ex:59
|
||||||
#: lib/cannery_web/live/tag_live/form_component.ex:101
|
#: lib/cannery_web/live/tag_live/form_component.ex:101
|
||||||
@ -50,7 +50,7 @@ msgid "%{name} updated succesfully"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_type_live/form_component.ex:46
|
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
|
||||||
#: lib/cannery_web/live/container_live/form_component.ex:48
|
#: lib/cannery_web/live/container_live/form_component.ex:48
|
||||||
#: lib/cannery_web/live/invite_live/form_component.ex:41
|
#: lib/cannery_web/live/invite_live/form_component.ex:41
|
||||||
#: lib/cannery_web/live/tag_live/form_component.ex:83
|
#: lib/cannery_web/live/tag_live/form_component.ex:83
|
||||||
@ -263,12 +263,12 @@ msgid "Ammo unstaged succesfully"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:105
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:108
|
||||||
msgid "Ammo updated successfully"
|
msgid "Ammo updated successfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:164
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:167
|
||||||
msgid "Ammo added successfully"
|
msgid "Ammo added successfully"
|
||||||
msgid_plural "Ammo added successfully"
|
msgid_plural "Ammo added successfully"
|
||||||
msgstr[0] ""
|
msgstr[0] ""
|
||||||
|
@ -160,17 +160,17 @@ msgid "Tag could not be removed"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:143
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:146
|
||||||
msgid "Could not parse number of copies"
|
msgid "Could not parse number of copies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:128
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:131
|
||||||
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
|
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery/ammo.ex:404
|
#: lib/cannery/ammo.ex:388
|
||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -171,17 +171,17 @@ msgid "Tag could not be removed"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:143
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:146
|
||||||
msgid "Could not parse number of copies"
|
msgid "Could not parse number of copies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:128
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:131
|
||||||
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
|
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery/ammo.ex:404
|
#: lib/cannery/ammo.ex:388
|
||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ msgstr ""
|
|||||||
## date. Leave "msgstr"s empty as changing them here has no
|
## date. Leave "msgstr"s empty as changing them here has no
|
||||||
## effect: edit them in PO (.po) files instead.
|
## effect: edit them in PO (.po) files instead.
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_type_live/form_component.ex:64
|
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
|
||||||
#: lib/cannery_web/live/container_live/form_component.ex:66
|
#: lib/cannery_web/live/container_live/form_component.ex:66
|
||||||
#: lib/cannery_web/live/invite_live/form_component.ex:59
|
#: lib/cannery_web/live/invite_live/form_component.ex:59
|
||||||
#: lib/cannery_web/live/tag_live/form_component.ex:101
|
#: lib/cannery_web/live/tag_live/form_component.ex:101
|
||||||
@ -60,7 +60,7 @@ msgid "%{name} updated succesfully"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_type_live/form_component.ex:46
|
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
|
||||||
#: lib/cannery_web/live/container_live/form_component.ex:48
|
#: lib/cannery_web/live/container_live/form_component.ex:48
|
||||||
#: lib/cannery_web/live/invite_live/form_component.ex:41
|
#: lib/cannery_web/live/invite_live/form_component.ex:41
|
||||||
#: lib/cannery_web/live/tag_live/form_component.ex:83
|
#: lib/cannery_web/live/tag_live/form_component.ex:83
|
||||||
@ -273,12 +273,12 @@ msgid "Ammo unstaged succesfully"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:105
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:108
|
||||||
msgid "Ammo updated successfully"
|
msgid "Ammo updated successfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:164
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:167
|
||||||
msgid "Ammo added successfully"
|
msgid "Ammo added successfully"
|
||||||
msgid_plural "Ammo added successfully"
|
msgid_plural "Ammo added successfully"
|
||||||
msgstr[0] ""
|
msgstr[0] ""
|
||||||
|
@ -177,17 +177,17 @@ msgid "Tag could not be removed"
|
|||||||
msgstr "Le tag n’a pas pu être retiré"
|
msgstr "Le tag n’a pas pu être retiré"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:143
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:146
|
||||||
msgid "Could not parse number of copies"
|
msgid "Could not parse number of copies"
|
||||||
msgstr "Impossible d'analyser le nombre de copies"
|
msgstr "Impossible d'analyser le nombre de copies"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:128
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:131
|
||||||
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
|
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
|
||||||
msgstr "Nombre de copies invalide, doit être 1 et %{max}. Été %{multiplier}"
|
msgstr "Nombre de copies invalide, doit être 1 et %{max}. Été %{multiplier}"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery/ammo.ex:404
|
#: lib/cannery/ammo.ex:388
|
||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ msgstr ""
|
|||||||
## date. Leave "msgstr"s empty as changing them here has no
|
## date. Leave "msgstr"s empty as changing them here has no
|
||||||
## effect: edit them in PO (.po) files instead.
|
## effect: edit them in PO (.po) files instead.
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_type_live/form_component.ex:64
|
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
|
||||||
#: lib/cannery_web/live/container_live/form_component.ex:66
|
#: lib/cannery_web/live/container_live/form_component.ex:66
|
||||||
#: lib/cannery_web/live/invite_live/form_component.ex:59
|
#: lib/cannery_web/live/invite_live/form_component.ex:59
|
||||||
#: lib/cannery_web/live/tag_live/form_component.ex:101
|
#: lib/cannery_web/live/tag_live/form_component.ex:101
|
||||||
@ -62,7 +62,7 @@ msgid "%{name} updated succesfully"
|
|||||||
msgstr "%{name} mis à jour avec succès"
|
msgstr "%{name} mis à jour avec succès"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_type_live/form_component.ex:46
|
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
|
||||||
#: lib/cannery_web/live/container_live/form_component.ex:48
|
#: lib/cannery_web/live/container_live/form_component.ex:48
|
||||||
#: lib/cannery_web/live/invite_live/form_component.ex:41
|
#: lib/cannery_web/live/invite_live/form_component.ex:41
|
||||||
#: lib/cannery_web/live/tag_live/form_component.ex:83
|
#: lib/cannery_web/live/tag_live/form_component.ex:83
|
||||||
@ -284,12 +284,12 @@ msgid "Ammo unstaged succesfully"
|
|||||||
msgstr "Groupe de munition désélectionner avec succès"
|
msgstr "Groupe de munition désélectionner avec succès"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:105
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:108
|
||||||
msgid "Ammo updated successfully"
|
msgid "Ammo updated successfully"
|
||||||
msgstr "Groupe de munition mis à jour avec succès"
|
msgstr "Groupe de munition mis à jour avec succès"
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:164
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:167
|
||||||
msgid "Ammo added successfully"
|
msgid "Ammo added successfully"
|
||||||
msgid_plural "Ammo added successfully"
|
msgid_plural "Ammo added successfully"
|
||||||
msgstr[0] "Groupe de munition mis à jour avec succès"
|
msgstr[0] "Groupe de munition mis à jour avec succès"
|
||||||
|
@ -11,7 +11,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_type_live/form_component.ex:64
|
#: lib/cannery_web/live/ammo_type_live/form_component.ex:85
|
||||||
#: lib/cannery_web/live/container_live/form_component.ex:66
|
#: lib/cannery_web/live/container_live/form_component.ex:66
|
||||||
#: lib/cannery_web/live/invite_live/form_component.ex:59
|
#: lib/cannery_web/live/invite_live/form_component.ex:59
|
||||||
#: lib/cannery_web/live/tag_live/form_component.ex:101
|
#: lib/cannery_web/live/tag_live/form_component.ex:101
|
||||||
@ -49,7 +49,7 @@ msgid "%{name} updated succesfully"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_type_live/form_component.ex:46
|
#: lib/cannery_web/live/ammo_type_live/form_component.ex:67
|
||||||
#: lib/cannery_web/live/container_live/form_component.ex:48
|
#: lib/cannery_web/live/container_live/form_component.ex:48
|
||||||
#: lib/cannery_web/live/invite_live/form_component.ex:41
|
#: lib/cannery_web/live/invite_live/form_component.ex:41
|
||||||
#: lib/cannery_web/live/tag_live/form_component.ex:83
|
#: lib/cannery_web/live/tag_live/form_component.ex:83
|
||||||
@ -262,12 +262,12 @@ msgid "Ammo unstaged succesfully"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:105
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:108
|
||||||
msgid "Ammo updated successfully"
|
msgid "Ammo updated successfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:164
|
#: lib/cannery_web/live/ammo_group_live/form_component.ex:167
|
||||||
msgid "Ammo added successfully"
|
msgid "Ammo added successfully"
|
||||||
msgid_plural "Ammo added successfully"
|
msgid_plural "Ammo added successfully"
|
||||||
msgstr[0] ""
|
msgstr[0] ""
|
||||||
|
@ -92,11 +92,6 @@ defmodule Cannery.AmmoTest do
|
|||||||
assert {:ok, %AmmoType{}} = Ammo.delete_ammo_type(ammo_type, current_user)
|
assert {:ok, %AmmoType{}} = Ammo.delete_ammo_type(ammo_type, current_user)
|
||||||
assert_raise Ecto.NoResultsError, fn -> Ammo.get_ammo_type!(ammo_type.id, current_user) end
|
assert_raise Ecto.NoResultsError, fn -> Ammo.get_ammo_type!(ammo_type.id, current_user) end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "change_ammo_type/1 returns a ammo_type changeset",
|
|
||||||
%{ammo_type: ammo_type} do
|
|
||||||
assert %Changeset{} = Ammo.change_ammo_type(ammo_type)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "ammo_groups" do
|
describe "ammo_groups" do
|
||||||
|
Loading…
Reference in New Issue
Block a user