Compare commits

..

3 Commits

Author SHA1 Message Date
5fd46c326f update gettext
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-01 19:16:59 -04:00
8c62a39c97 bump to 0.5.4 2022-07-01 19:16:31 -04:00
9a1a104c6d add pack and round count to containers 2022-07-01 19:13:54 -04:00
21 changed files with 94 additions and 29 deletions

View File

@ -1,7 +1,8 @@
# v0.5.4
- Rename "Ammo" tab to "Catalog", and "Manage" tab is now "Ammo"
- Ammo groups are now just referred to as Ammo
- Ammo groups are now just referred to as Ammo or "Packs"
- URL paths now reflect new names
- Add pack and round count to container information
# v0.5.3
- Update French translation: Thank you [duponin](https://udongein.xyz/users/duponin)!

View File

@ -207,6 +207,18 @@ defmodule Cannery.Containers do
if count == 0, do: raise("could not delete container tag"), else: count
end
@doc """
Returns number of rounds in container. If data is already preloaded, then
there will be no db hit.
"""
@spec get_container_ammo_group_count!(Container.t()) :: non_neg_integer()
def get_container_ammo_group_count!(%Container{} = container) do
container
|> Repo.preload(:ammo_groups)
|> Map.fetch!(:ammo_groups)
|> Enum.count()
end
@doc """
Returns number of rounds in container. If data is already preloaded, then
there will be no db hit.

View File

@ -45,7 +45,12 @@ defmodule CanneryWeb.Components.ContainerCard do
</span>
<% end %>
<%= if @container.ammo_groups do %>
<%= unless @container.ammo_groups |> Enum.empty?() do %>
<span class="rounded-lg title text-lg">
<%= gettext("Packs:") %>
<%= @container |> Containers.get_container_ammo_group_count!() %>
</span>
<span class="rounded-lg title text-lg">
<%= gettext("Rounds:") %>
<%= @container |> Containers.get_container_rounds!() %>

View File

@ -22,6 +22,18 @@
</span>
<% end %>
<%= unless @container.ammo_groups |> Enum.empty?() do %>
<span class="rounded-lg title text-lg">
<%= gettext("Packs:") %>
<%= @container |> Containers.get_container_ammo_group_count!() %>
</span>
<span class="rounded-lg title text-lg">
<%= gettext("Rounds:") %>
<%= @container |> Containers.get_container_rounds!() %>
</span>
<% end %>
<div class="flex space-x-4 justify-center items-center text-primary-600">
<%= live_patch to: Routes.container_show_path(Endpoint, :edit, @container),
class: "text-primary-600 link",

View File

@ -126,7 +126,7 @@ defmodule CanneryWeb.HomeLive do
to: "https://gitea.bubbletea.dev/shibao/cannery/src/branch/stable/CHANGELOG.md",
target: "_blank",
rel: "noopener noreferrer" do %>
<p>0.5.3</p>
<p>0.5.4</p>
<i class="fas fa-md fa-info-circle"></i>
<% end %>
</li>

View File

@ -4,7 +4,7 @@ defmodule Cannery.MixProject do
def project do
[
app: :cannery,
version: "0.5.3",
version: "0.5.4",
elixir: "1.13.4",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:gettext] ++ Mix.compilers(),

View File

@ -136,7 +136,7 @@ msgid "Send instructions to reset password"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:53
#: lib/cannery_web/live/container_live/show.html.heex:65
msgid "Why not add one?"
msgstr ""

View File

@ -149,7 +149,7 @@ msgid "Send instructions to reset password"
msgstr "Anleitung zum Passwort zurücksetzen zusenden"
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:53
#: lib/cannery_web/live/container_live/show.html.heex:65
msgid "Why not add one?"
msgstr "Warum fügen Sie keine hinzu?"

View File

@ -502,7 +502,7 @@ msgid "Your data stays with you, period"
msgstr "Ihre Daten bleiben bei Ihnen, Punkt"
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:49
#: lib/cannery_web/live/container_live/show.html.heex:61
msgid "No tags for this container"
msgstr "Keine Tags für diesen Behälter"
@ -720,7 +720,8 @@ msgid "Edit %{name} tags"
msgstr "Editiere %{name} Tags"
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/container_card.ex:50
#: lib/cannery_web/components/container_card.ex:55
#: lib/cannery_web/live/container_live/show.html.heex:32
msgid "Rounds:"
msgstr "Patronen:"
@ -898,7 +899,7 @@ msgid "Move Ammo"
msgstr "Munition verschieben"
#, elixir-autogen, elixir-format, fuzzy
#: lib/cannery_web/live/container_live/show.html.heex:78
#: lib/cannery_web/live/container_live/show.html.heex:90
msgid "No ammo in this container"
msgstr "Keine Munitionsgruppe in diesem Behälter"
@ -911,3 +912,9 @@ msgstr "Zeige Munitionsarten"
#: lib/cannery_web/live/ammo_group_live/show.html.heex:108
msgid "This ammo is not in a container"
msgstr "Diese Munitionsgruppe ist nicht in einem Behälter"
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/container_card.ex:50
#: lib/cannery_web/live/container_live/show.html.heex:27
msgid "Packs:"
msgstr ""

View File

@ -90,7 +90,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/show.html.heex:27
#: lib/cannery_web/live/container_live/index.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:37
#: lib/cannery_web/live/container_live/show.html.heex:49
#: lib/cannery_web/live/tag_live/index.html.heex:38
msgid "Are you sure you want to delete %{name}?"
msgstr "Sind Sie sicher, dass sie %{name} löschen möchten?"

View File

@ -485,7 +485,7 @@ msgid "Your data stays with you, period"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:49
#: lib/cannery_web/live/container_live/show.html.heex:61
msgid "No tags for this container"
msgstr ""
@ -703,7 +703,8 @@ msgid "Edit %{name} tags"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/container_card.ex:50
#: lib/cannery_web/components/container_card.ex:55
#: lib/cannery_web/live/container_live/show.html.heex:32
msgid "Rounds:"
msgstr ""
@ -881,7 +882,7 @@ msgid "Move Ammo"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:78
#: lib/cannery_web/live/container_live/show.html.heex:90
msgid "No ammo in this container"
msgstr ""
@ -894,3 +895,9 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:108
msgid "This ammo is not in a container"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/container_card.ex:50
#: lib/cannery_web/live/container_live/show.html.heex:27
msgid "Packs:"
msgstr ""

View File

@ -137,7 +137,7 @@ msgid "Send instructions to reset password"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:53
#: lib/cannery_web/live/container_live/show.html.heex:65
msgid "Why not add one?"
msgstr ""

View File

@ -486,7 +486,7 @@ msgid "Your data stays with you, period"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:49
#: lib/cannery_web/live/container_live/show.html.heex:61
msgid "No tags for this container"
msgstr ""
@ -704,7 +704,8 @@ msgid "Edit %{name} tags"
msgstr ""
#, elixir-autogen, elixir-format, fuzzy
#: lib/cannery_web/components/container_card.ex:50
#: lib/cannery_web/components/container_card.ex:55
#: lib/cannery_web/live/container_live/show.html.heex:32
msgid "Rounds:"
msgstr ""
@ -882,7 +883,7 @@ msgid "Move Ammo"
msgstr ""
#, elixir-autogen, elixir-format, fuzzy
#: lib/cannery_web/live/container_live/show.html.heex:78
#: lib/cannery_web/live/container_live/show.html.heex:90
msgid "No ammo in this container"
msgstr ""
@ -895,3 +896,9 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:108
msgid "This ammo is not in a container"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/container_card.ex:50
#: lib/cannery_web/live/container_live/show.html.heex:27
msgid "Packs:"
msgstr ""

View File

@ -76,7 +76,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/show.html.heex:27
#: lib/cannery_web/live/container_live/index.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:37
#: lib/cannery_web/live/container_live/show.html.heex:49
#: lib/cannery_web/live/tag_live/index.html.heex:38
msgid "Are you sure you want to delete %{name}?"
msgstr ""

View File

@ -147,7 +147,7 @@ msgid "Send instructions to reset password"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:53
#: lib/cannery_web/live/container_live/show.html.heex:65
msgid "Why not add one?"
msgstr ""

View File

@ -496,7 +496,7 @@ msgid "Your data stays with you, period"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:49
#: lib/cannery_web/live/container_live/show.html.heex:61
msgid "No tags for this container"
msgstr ""
@ -714,7 +714,8 @@ msgid "Edit %{name} tags"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/container_card.ex:50
#: lib/cannery_web/components/container_card.ex:55
#: lib/cannery_web/live/container_live/show.html.heex:32
msgid "Rounds:"
msgstr ""
@ -892,7 +893,7 @@ msgid "Move Ammo"
msgstr ""
#, elixir-autogen, elixir-format, fuzzy
#: lib/cannery_web/live/container_live/show.html.heex:78
#: lib/cannery_web/live/container_live/show.html.heex:90
msgid "No ammo in this container"
msgstr ""
@ -905,3 +906,9 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:108
msgid "This ammo is not in a container"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/container_card.ex:50
#: lib/cannery_web/live/container_live/show.html.heex:27
msgid "Packs:"
msgstr ""

View File

@ -86,7 +86,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/show.html.heex:27
#: lib/cannery_web/live/container_live/index.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:37
#: lib/cannery_web/live/container_live/show.html.heex:49
#: lib/cannery_web/live/tag_live/index.html.heex:38
msgid "Are you sure you want to delete %{name}?"
msgstr ""

View File

@ -149,7 +149,7 @@ msgid "Send instructions to reset password"
msgstr "Envoyer les instructions pour réinitialiser le mot de passe"
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:53
#: lib/cannery_web/live/container_live/show.html.heex:65
msgid "Why not add one?"
msgstr "Pourquoi pas en ajouter un?"

View File

@ -504,7 +504,7 @@ msgid "Your data stays with you, period"
msgstr "Vos données restent avec vous, point final"
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:49
#: lib/cannery_web/live/container_live/show.html.heex:61
msgid "No tags for this container"
msgstr "Aucun tag pour ce conteneur"
@ -722,7 +722,8 @@ msgid "Edit %{name} tags"
msgstr "Éditer les tags de %{name}"
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/container_card.ex:50
#: lib/cannery_web/components/container_card.ex:55
#: lib/cannery_web/live/container_live/show.html.heex:32
msgid "Rounds:"
msgstr "Cartouches:"
@ -900,7 +901,7 @@ msgid "Move Ammo"
msgstr "Déplacer munition"
#, elixir-autogen, elixir-format, fuzzy
#: lib/cannery_web/live/container_live/show.html.heex:78
#: lib/cannery_web/live/container_live/show.html.heex:90
msgid "No ammo in this container"
msgstr "Aucun groupe de munition pour ce conteneur"
@ -913,3 +914,9 @@ msgstr "Montrer le type de munition"
#: lib/cannery_web/live/ammo_group_live/show.html.heex:108
msgid "This ammo is not in a container"
msgstr "Ce groupe de munition nest pas dans un conteneur"
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/container_card.ex:50
#: lib/cannery_web/live/container_live/show.html.heex:27
msgid "Packs:"
msgstr ""

View File

@ -91,7 +91,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/show.html.heex:27
#: lib/cannery_web/live/container_live/index.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:37
#: lib/cannery_web/live/container_live/show.html.heex:49
#: lib/cannery_web/live/tag_live/index.html.heex:38
msgid "Are you sure you want to delete %{name}?"
msgstr "Êtes-vous certain·e de supprimer %{name}?"

View File

@ -75,7 +75,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/show.html.heex:27
#: lib/cannery_web/live/container_live/index.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:37
#: lib/cannery_web/live/container_live/show.html.heex:49
#: lib/cannery_web/live/tag_live/index.html.heex:38
msgid "Are you sure you want to delete %{name}?"
msgstr ""