From 0c088ed06d25c82c434cc1e6b00c80d4982f9332 Mon Sep 17 00:00:00 2001 From: shibao Date: Thu, 10 Nov 2022 22:01:32 -0500 Subject: [PATCH] add button to set shot group to zero --- CHANGELOG.md | 1 + assets/js/app.js | 5 +++++ .../components/add_shot_group_component.ex | 2 +- .../components/add_shot_group_component.html.heex | 11 +++++++++-- priv/gettext/actions.pot | 2 +- priv/gettext/de/LC_MESSAGES/actions.po | 2 +- priv/gettext/de/LC_MESSAGES/default.po | 10 ++++++++-- priv/gettext/de/LC_MESSAGES/prompts.po | 2 +- priv/gettext/default.pot | 10 ++++++++-- priv/gettext/en/LC_MESSAGES/actions.po | 2 +- priv/gettext/en/LC_MESSAGES/default.po | 10 ++++++++-- priv/gettext/en/LC_MESSAGES/prompts.po | 2 +- priv/gettext/es/LC_MESSAGES/actions.po | 2 +- priv/gettext/es/LC_MESSAGES/default.po | 10 ++++++++-- priv/gettext/es/LC_MESSAGES/prompts.po | 2 +- priv/gettext/fr/LC_MESSAGES/actions.po | 2 +- priv/gettext/fr/LC_MESSAGES/default.po | 10 ++++++++-- priv/gettext/fr/LC_MESSAGES/prompts.po | 2 +- priv/gettext/ga/LC_MESSAGES/actions.po | 2 +- priv/gettext/ga/LC_MESSAGES/default.po | 10 ++++++++-- priv/gettext/ga/LC_MESSAGES/prompts.po | 2 +- priv/gettext/prompts.pot | 2 +- 22 files changed, 76 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04edcfc9..c52f23c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Add ammo type cloning - Add container cloning - Fix bug with moving ammo packs between containers +- Add button to set rounds left to 0 when creating a shot group - Update project dependencies # v0.5.4 diff --git a/assets/js/app.js b/assets/js/app.js index 962985ea..4c3e2731 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -67,3 +67,8 @@ window.addEventListener('cannery:clipcopy', (event) => { window.alert('Sorry, your browser does not support clipboard copy.') } }) + +// Set input value to 0 +window.addEventListener('cannery:set-zero', (event) => { + event.target.value = 0 +}) diff --git a/lib/cannery_web/components/add_shot_group_component.ex b/lib/cannery_web/components/add_shot_group_component.ex index 0beb3cc4..47dbae45 100644 --- a/lib/cannery_web/components/add_shot_group_component.ex +++ b/lib/cannery_web/components/add_shot_group_component.ex @@ -5,7 +5,7 @@ defmodule CanneryWeb.Components.AddShotGroupComponent do use CanneryWeb, :live_component alias Cannery.{Accounts.User, ActivityLog, ActivityLog.ShotGroup, Ammo.AmmoGroup} - alias Phoenix.LiveView.Socket + alias Phoenix.LiveView.{JS, Socket} @impl true @spec update( diff --git a/lib/cannery_web/components/add_shot_group_component.html.heex b/lib/cannery_web/components/add_shot_group_component.html.heex index 7e0fc219..7f50081b 100644 --- a/lib/cannery_web/components/add_shot_group_component.html.heex +++ b/lib/cannery_web/components/add_shot_group_component.html.heex @@ -22,9 +22,16 @@ <%= number_input(f, :ammo_left, min: 0, max: @ammo_group.count - 1, - placeholder: 0, - class: "input input-primary col-span-2" + placeholder: gettext("Rounds left"), + class: "input input-primary" ) %> + <%= error_tag(f, :ammo_left, "col-span-3") %> <%= label(f, :notes, gettext("Notes"), class: "title text-lg text-primary-600") %> diff --git a/priv/gettext/actions.pot b/priv/gettext/actions.pot index a0e66c8c..91479005 100644 --- a/priv/gettext/actions.pot +++ b/priv/gettext/actions.pot @@ -120,7 +120,7 @@ msgstr "" msgid "Reset password" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:46 +#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/container_live/form_component.html.heex:50 diff --git a/priv/gettext/de/LC_MESSAGES/actions.po b/priv/gettext/de/LC_MESSAGES/actions.po index 41257b86..5b3b29b0 100644 --- a/priv/gettext/de/LC_MESSAGES/actions.po +++ b/priv/gettext/de/LC_MESSAGES/actions.po @@ -133,7 +133,7 @@ msgstr "Bestätigungsmail erneut senden" msgid "Reset password" msgstr "Passwort zurücksetzen" -#: lib/cannery_web/components/add_shot_group_component.html.heex:46 +#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/container_live/form_component.html.heex:50 diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po index ba3d4064..3038c3b9 100644 --- a/priv/gettext/de/LC_MESSAGES/default.po +++ b/priv/gettext/de/LC_MESSAGES/default.po @@ -338,7 +338,7 @@ msgstr "Keine Einladung" msgid "No tags" msgstr "Keine Tags" -#: lib/cannery_web/components/add_shot_group_component.html.heex:30 +#: lib/cannery_web/components/add_shot_group_component.html.heex:37 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:88 #: lib/cannery_web/live/range_live/form_component.html.heex:29 @@ -537,7 +537,7 @@ msgstr "Schüsse dokumentieren" msgid "Ammo groups" msgstr "Munitionsgruppen" -#: lib/cannery_web/components/add_shot_group_component.html.heex:38 +#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/live/range_live/form_component.html.heex:36 #, elixir-autogen, elixir-format msgid "Date (UTC)" @@ -560,6 +560,7 @@ msgid "No shots recorded" msgstr "Keine Schüsse dokumentiert" #: lib/cannery_web/components/add_shot_group_component.html.heex:21 +#: lib/cannery_web/components/add_shot_group_component.html.heex:25 #, elixir-autogen, elixir-format msgid "Rounds left" msgstr "Patronen verbleibend" @@ -1012,3 +1013,8 @@ msgstr "" #, elixir-autogen, elixir-format, fuzzy msgid "Used rounds:" msgstr "" + +#: lib/cannery_web/components/add_shot_group_component.html.heex:33 +#, elixir-autogen, elixir-format, fuzzy +msgid "Used up!" +msgstr "" diff --git a/priv/gettext/de/LC_MESSAGES/prompts.po b/priv/gettext/de/LC_MESSAGES/prompts.po index 4e7d775c..9d923d06 100644 --- a/priv/gettext/de/LC_MESSAGES/prompts.po +++ b/priv/gettext/de/LC_MESSAGES/prompts.po @@ -165,7 +165,7 @@ msgstr "Bitte überprüfen Sie ihre Mailbox und bestätigen Sie das Nutzerkonto" msgid "Register to setup %{name}" msgstr "Registrieren Sie sich, um %{name} zu bearbeiten" -#: lib/cannery_web/components/add_shot_group_component.html.heex:48 +#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/container_live/form_component.html.heex:52 diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index fe2e1dae..12df682e 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -323,7 +323,7 @@ msgstr "" msgid "No tags" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:30 +#: lib/cannery_web/components/add_shot_group_component.html.heex:37 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:88 #: lib/cannery_web/live/range_live/form_component.html.heex:29 @@ -520,7 +520,7 @@ msgstr "" msgid "Ammo groups" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:38 +#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/live/range_live/form_component.html.heex:36 #, elixir-autogen, elixir-format msgid "Date (UTC)" @@ -543,6 +543,7 @@ msgid "No shots recorded" msgstr "" #: lib/cannery_web/components/add_shot_group_component.html.heex:21 +#: lib/cannery_web/components/add_shot_group_component.html.heex:25 #, elixir-autogen, elixir-format msgid "Rounds left" msgstr "" @@ -995,3 +996,8 @@ msgstr "" #, elixir-autogen, elixir-format msgid "Used rounds:" msgstr "" + +#: lib/cannery_web/components/add_shot_group_component.html.heex:33 +#, elixir-autogen, elixir-format +msgid "Used up!" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/actions.po b/priv/gettext/en/LC_MESSAGES/actions.po index 457abffa..e3de8021 100644 --- a/priv/gettext/en/LC_MESSAGES/actions.po +++ b/priv/gettext/en/LC_MESSAGES/actions.po @@ -121,7 +121,7 @@ msgstr "" msgid "Reset password" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:46 +#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/container_live/form_component.html.heex:50 diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index a1e93c93..dd8be40c 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -324,7 +324,7 @@ msgstr "" msgid "No tags" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:30 +#: lib/cannery_web/components/add_shot_group_component.html.heex:37 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:88 #: lib/cannery_web/live/range_live/form_component.html.heex:29 @@ -521,7 +521,7 @@ msgstr "" msgid "Ammo groups" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:38 +#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/live/range_live/form_component.html.heex:36 #, elixir-autogen, elixir-format msgid "Date (UTC)" @@ -544,6 +544,7 @@ msgid "No shots recorded" msgstr "" #: lib/cannery_web/components/add_shot_group_component.html.heex:21 +#: lib/cannery_web/components/add_shot_group_component.html.heex:25 #, elixir-autogen, elixir-format msgid "Rounds left" msgstr "" @@ -996,3 +997,8 @@ msgstr "" #, elixir-autogen, elixir-format, fuzzy msgid "Used rounds:" msgstr "" + +#: lib/cannery_web/components/add_shot_group_component.html.heex:33 +#, elixir-autogen, elixir-format, fuzzy +msgid "Used up!" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po index 98293988..a35d726e 100644 --- a/priv/gettext/en/LC_MESSAGES/prompts.po +++ b/priv/gettext/en/LC_MESSAGES/prompts.po @@ -147,7 +147,7 @@ msgstr "" msgid "Register to setup %{name}" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:48 +#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/container_live/form_component.html.heex:52 diff --git a/priv/gettext/es/LC_MESSAGES/actions.po b/priv/gettext/es/LC_MESSAGES/actions.po index 335870a3..cb8aabb7 100644 --- a/priv/gettext/es/LC_MESSAGES/actions.po +++ b/priv/gettext/es/LC_MESSAGES/actions.po @@ -133,7 +133,7 @@ msgstr "" msgid "Reset password" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:46 +#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/container_live/form_component.html.heex:50 diff --git a/priv/gettext/es/LC_MESSAGES/default.po b/priv/gettext/es/LC_MESSAGES/default.po index dee16934..c73806d7 100644 --- a/priv/gettext/es/LC_MESSAGES/default.po +++ b/priv/gettext/es/LC_MESSAGES/default.po @@ -338,7 +338,7 @@ msgstr "" msgid "No tags" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:30 +#: lib/cannery_web/components/add_shot_group_component.html.heex:37 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:88 #: lib/cannery_web/live/range_live/form_component.html.heex:29 @@ -535,7 +535,7 @@ msgstr "" msgid "Ammo groups" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:38 +#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/live/range_live/form_component.html.heex:36 #, elixir-autogen, elixir-format msgid "Date (UTC)" @@ -558,6 +558,7 @@ msgid "No shots recorded" msgstr "" #: lib/cannery_web/components/add_shot_group_component.html.heex:21 +#: lib/cannery_web/components/add_shot_group_component.html.heex:25 #, elixir-autogen, elixir-format msgid "Rounds left" msgstr "" @@ -1010,3 +1011,8 @@ msgstr "" #, elixir-autogen, elixir-format, fuzzy msgid "Used rounds:" msgstr "" + +#: lib/cannery_web/components/add_shot_group_component.html.heex:33 +#, elixir-autogen, elixir-format, fuzzy +msgid "Used up!" +msgstr "" diff --git a/priv/gettext/es/LC_MESSAGES/prompts.po b/priv/gettext/es/LC_MESSAGES/prompts.po index c85929aa..eb2f225b 100644 --- a/priv/gettext/es/LC_MESSAGES/prompts.po +++ b/priv/gettext/es/LC_MESSAGES/prompts.po @@ -165,7 +165,7 @@ msgstr "Por favor chequea el correo para verificar tu cuenta" msgid "Register to setup %{name}" msgstr "Regístrese para configurar %{name}" -#: lib/cannery_web/components/add_shot_group_component.html.heex:48 +#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/container_live/form_component.html.heex:52 diff --git a/priv/gettext/fr/LC_MESSAGES/actions.po b/priv/gettext/fr/LC_MESSAGES/actions.po index 998af223..f3862d05 100644 --- a/priv/gettext/fr/LC_MESSAGES/actions.po +++ b/priv/gettext/fr/LC_MESSAGES/actions.po @@ -133,7 +133,7 @@ msgstr "Renvoyer les instructions de confirmation" msgid "Reset password" msgstr "Réinitialisé le mot de passe" -#: lib/cannery_web/components/add_shot_group_component.html.heex:46 +#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/container_live/form_component.html.heex:50 diff --git a/priv/gettext/fr/LC_MESSAGES/default.po b/priv/gettext/fr/LC_MESSAGES/default.po index 8f274ccb..4be1baa1 100644 --- a/priv/gettext/fr/LC_MESSAGES/default.po +++ b/priv/gettext/fr/LC_MESSAGES/default.po @@ -338,7 +338,7 @@ msgstr "Aucune invitation" msgid "No tags" msgstr "Aucun tag" -#: lib/cannery_web/components/add_shot_group_component.html.heex:30 +#: lib/cannery_web/components/add_shot_group_component.html.heex:37 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:88 #: lib/cannery_web/live/range_live/form_component.html.heex:29 @@ -539,7 +539,7 @@ msgstr "Tirs enregistrés" msgid "Ammo groups" msgstr "Groupes de munition" -#: lib/cannery_web/components/add_shot_group_component.html.heex:38 +#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/live/range_live/form_component.html.heex:36 #, elixir-autogen, elixir-format msgid "Date (UTC)" @@ -562,6 +562,7 @@ msgid "No shots recorded" msgstr "Aucun tir enregistré" #: lib/cannery_web/components/add_shot_group_component.html.heex:21 +#: lib/cannery_web/components/add_shot_group_component.html.heex:25 #, elixir-autogen, elixir-format msgid "Rounds left" msgstr "Cartouches restantes" @@ -1015,3 +1016,8 @@ msgstr "" #, elixir-autogen, elixir-format, fuzzy msgid "Used rounds:" msgstr "" + +#: lib/cannery_web/components/add_shot_group_component.html.heex:33 +#, elixir-autogen, elixir-format, fuzzy +msgid "Used up!" +msgstr "" diff --git a/priv/gettext/fr/LC_MESSAGES/prompts.po b/priv/gettext/fr/LC_MESSAGES/prompts.po index 7ca6b153..10a86259 100644 --- a/priv/gettext/fr/LC_MESSAGES/prompts.po +++ b/priv/gettext/fr/LC_MESSAGES/prompts.po @@ -166,7 +166,7 @@ msgstr "Veuillez vérifier votre mél pour confirmer votre compte" msgid "Register to setup %{name}" msgstr "S’enregistrer pour mettre en place %{name}" -#: lib/cannery_web/components/add_shot_group_component.html.heex:48 +#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/container_live/form_component.html.heex:52 diff --git a/priv/gettext/ga/LC_MESSAGES/actions.po b/priv/gettext/ga/LC_MESSAGES/actions.po index 5b7529d6..b17f7756 100644 --- a/priv/gettext/ga/LC_MESSAGES/actions.po +++ b/priv/gettext/ga/LC_MESSAGES/actions.po @@ -131,7 +131,7 @@ msgstr "" msgid "Reset password" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:46 +#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/container_live/form_component.html.heex:50 diff --git a/priv/gettext/ga/LC_MESSAGES/default.po b/priv/gettext/ga/LC_MESSAGES/default.po index f856dd22..0a245290 100644 --- a/priv/gettext/ga/LC_MESSAGES/default.po +++ b/priv/gettext/ga/LC_MESSAGES/default.po @@ -334,7 +334,7 @@ msgstr "" msgid "No tags" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:30 +#: lib/cannery_web/components/add_shot_group_component.html.heex:37 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:88 #: lib/cannery_web/live/range_live/form_component.html.heex:29 @@ -531,7 +531,7 @@ msgstr "" msgid "Ammo groups" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:38 +#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/live/range_live/form_component.html.heex:36 #, elixir-autogen, elixir-format msgid "Date (UTC)" @@ -554,6 +554,7 @@ msgid "No shots recorded" msgstr "" #: lib/cannery_web/components/add_shot_group_component.html.heex:21 +#: lib/cannery_web/components/add_shot_group_component.html.heex:25 #, elixir-autogen, elixir-format msgid "Rounds left" msgstr "" @@ -1006,3 +1007,8 @@ msgstr "" #, elixir-autogen, elixir-format, fuzzy msgid "Used rounds:" msgstr "" + +#: lib/cannery_web/components/add_shot_group_component.html.heex:33 +#, elixir-autogen, elixir-format, fuzzy +msgid "Used up!" +msgstr "" diff --git a/priv/gettext/ga/LC_MESSAGES/prompts.po b/priv/gettext/ga/LC_MESSAGES/prompts.po index d9537084..26e89ec0 100644 --- a/priv/gettext/ga/LC_MESSAGES/prompts.po +++ b/priv/gettext/ga/LC_MESSAGES/prompts.po @@ -157,7 +157,7 @@ msgstr "" msgid "Register to setup %{name}" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:48 +#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/container_live/form_component.html.heex:52 diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot index b11dba89..7517a5ef 100644 --- a/priv/gettext/prompts.pot +++ b/priv/gettext/prompts.pot @@ -146,7 +146,7 @@ msgstr "" msgid "Register to setup %{name}" msgstr "" -#: lib/cannery_web/components/add_shot_group_component.html.heex:48 +#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/container_live/form_component.html.heex:52