diff --git a/lib/cannery_web/components/container_card.ex b/lib/cannery_web/components/container_card.ex index b96c095..d810e21 100644 --- a/lib/cannery_web/components/container_card.ex +++ b/lib/cannery_web/components/container_card.ex @@ -5,11 +5,20 @@ defmodule CanneryWeb.Components.ContainerCard do use CanneryWeb, :component import CanneryWeb.Components.TagCard - alias Cannery.{Containers, Repo} + alias Cannery.{Containers, Containers.Container, Repo} alias CanneryWeb.Endpoint + alias Phoenix.LiveView.Rendered + attr :container, Container, required: true + slot(:tag_actions) + slot(:inner_block) + + @spec container_card(assigns :: map()) :: Rendered.t() def container_card(%{container: container} = assigns) do - assigns = assigns |> Map.put(:container, container |> Repo.preload([:tags, :ammo_groups])) + assigns = + assigns + |> assign(container: container |> Repo.preload([:tags, :ammo_groups])) + |> assign_new(:tag_actions, fn -> [] end) ~H"""
<% end %> - <%= if assigns |> Map.has_key?(:tag_actions) do %> - <%= render_slot(@tag_actions) %> - <% end %> + <%= render_slot(@tag_actions) %>
diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po index 6f9d084..00e1582 100644 --- a/priv/gettext/de/LC_MESSAGES/default.po +++ b/priv/gettext/de/LC_MESSAGES/default.po @@ -155,7 +155,7 @@ msgstr "Anzahl:" msgid "Description" msgstr "Beschreibung" -#: lib/cannery_web/components/container_card.ex:30 +#: lib/cannery_web/components/container_card.ex:39 #: lib/cannery_web/live/container_live/show.html.heex:8 #, elixir-autogen, elixir-format msgid "Description:" @@ -244,7 +244,7 @@ msgstr "Für 60 Tage eingeloggt bleiben" msgid "Location" msgstr "Standort" -#: lib/cannery_web/components/container_card.ex:42 +#: lib/cannery_web/components/container_card.ex:51 #: lib/cannery_web/live/container_live/show.html.heex:20 #, elixir-autogen, elixir-format msgid "Location:" @@ -455,7 +455,7 @@ msgstr "Leuchtspur" msgid "Type" msgstr "Art" -#: lib/cannery_web/components/container_card.ex:36 +#: lib/cannery_web/components/container_card.ex:45 #: lib/cannery_web/live/container_live/show.html.heex:14 #, elixir-autogen, elixir-format msgid "Type:" @@ -692,7 +692,7 @@ msgstr "%{name} bearbeiten" msgid "Edit %{name} tags" msgstr "Editiere %{name} Tags" -#: lib/cannery_web/components/container_card.ex:54 +#: lib/cannery_web/components/container_card.ex:63 #: lib/cannery_web/live/container_live/show.html.heex:32 #, elixir-autogen, elixir-format msgid "Rounds:" @@ -886,7 +886,7 @@ msgstr "Zeige Munitionsarten" msgid "This ammo is not in a container" msgstr "Diese Munitionsgruppe ist nicht in einem Behälter" -#: lib/cannery_web/components/container_card.ex:49 +#: lib/cannery_web/components/container_card.ex:58 #: lib/cannery_web/live/container_live/show.html.heex:27 #, elixir-autogen, elixir-format msgid "Packs:" diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 7d872cc..0fb6cac 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -140,7 +140,7 @@ msgstr "" msgid "Description" msgstr "" -#: lib/cannery_web/components/container_card.ex:30 +#: lib/cannery_web/components/container_card.ex:39 #: lib/cannery_web/live/container_live/show.html.heex:8 #, elixir-autogen, elixir-format msgid "Description:" @@ -229,7 +229,7 @@ msgstr "" msgid "Location" msgstr "" -#: lib/cannery_web/components/container_card.ex:42 +#: lib/cannery_web/components/container_card.ex:51 #: lib/cannery_web/live/container_live/show.html.heex:20 #, elixir-autogen, elixir-format msgid "Location:" @@ -438,7 +438,7 @@ msgstr "" msgid "Type" msgstr "" -#: lib/cannery_web/components/container_card.ex:36 +#: lib/cannery_web/components/container_card.ex:45 #: lib/cannery_web/live/container_live/show.html.heex:14 #, elixir-autogen, elixir-format msgid "Type:" @@ -675,7 +675,7 @@ msgstr "" msgid "Edit %{name} tags" msgstr "" -#: lib/cannery_web/components/container_card.ex:54 +#: lib/cannery_web/components/container_card.ex:63 #: lib/cannery_web/live/container_live/show.html.heex:32 #, elixir-autogen, elixir-format msgid "Rounds:" @@ -869,7 +869,7 @@ msgstr "" msgid "This ammo is not in a container" msgstr "" -#: lib/cannery_web/components/container_card.ex:49 +#: lib/cannery_web/components/container_card.ex:58 #: lib/cannery_web/live/container_live/show.html.heex:27 #, elixir-autogen, elixir-format msgid "Packs:" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index da92ca0..c7cbc94 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -141,7 +141,7 @@ msgstr "" msgid "Description" msgstr "" -#: lib/cannery_web/components/container_card.ex:30 +#: lib/cannery_web/components/container_card.ex:39 #: lib/cannery_web/live/container_live/show.html.heex:8 #, elixir-autogen, elixir-format msgid "Description:" @@ -230,7 +230,7 @@ msgstr "" msgid "Location" msgstr "" -#: lib/cannery_web/components/container_card.ex:42 +#: lib/cannery_web/components/container_card.ex:51 #: lib/cannery_web/live/container_live/show.html.heex:20 #, elixir-autogen, elixir-format msgid "Location:" @@ -439,7 +439,7 @@ msgstr "" msgid "Type" msgstr "" -#: lib/cannery_web/components/container_card.ex:36 +#: lib/cannery_web/components/container_card.ex:45 #: lib/cannery_web/live/container_live/show.html.heex:14 #, elixir-autogen, elixir-format msgid "Type:" @@ -676,7 +676,7 @@ msgstr "" msgid "Edit %{name} tags" msgstr "" -#: lib/cannery_web/components/container_card.ex:54 +#: lib/cannery_web/components/container_card.ex:63 #: lib/cannery_web/live/container_live/show.html.heex:32 #, elixir-autogen, elixir-format, fuzzy msgid "Rounds:" @@ -870,7 +870,7 @@ msgstr "" msgid "This ammo is not in a container" msgstr "" -#: lib/cannery_web/components/container_card.ex:49 +#: lib/cannery_web/components/container_card.ex:58 #: lib/cannery_web/live/container_live/show.html.heex:27 #, elixir-autogen, elixir-format msgid "Packs:" diff --git a/priv/gettext/es/LC_MESSAGES/default.po b/priv/gettext/es/LC_MESSAGES/default.po index 1695ffa..c61d50b 100644 --- a/priv/gettext/es/LC_MESSAGES/default.po +++ b/priv/gettext/es/LC_MESSAGES/default.po @@ -155,7 +155,7 @@ msgstr "" msgid "Description" msgstr "" -#: lib/cannery_web/components/container_card.ex:30 +#: lib/cannery_web/components/container_card.ex:39 #: lib/cannery_web/live/container_live/show.html.heex:8 #, elixir-autogen, elixir-format msgid "Description:" @@ -244,7 +244,7 @@ msgstr "" msgid "Location" msgstr "" -#: lib/cannery_web/components/container_card.ex:42 +#: lib/cannery_web/components/container_card.ex:51 #: lib/cannery_web/live/container_live/show.html.heex:20 #, elixir-autogen, elixir-format msgid "Location:" @@ -453,7 +453,7 @@ msgstr "" msgid "Type" msgstr "" -#: lib/cannery_web/components/container_card.ex:36 +#: lib/cannery_web/components/container_card.ex:45 #: lib/cannery_web/live/container_live/show.html.heex:14 #, elixir-autogen, elixir-format msgid "Type:" @@ -690,7 +690,7 @@ msgstr "" msgid "Edit %{name} tags" msgstr "" -#: lib/cannery_web/components/container_card.ex:54 +#: lib/cannery_web/components/container_card.ex:63 #: lib/cannery_web/live/container_live/show.html.heex:32 #, elixir-autogen, elixir-format msgid "Rounds:" @@ -884,7 +884,7 @@ msgstr "" msgid "This ammo is not in a container" msgstr "" -#: lib/cannery_web/components/container_card.ex:49 +#: lib/cannery_web/components/container_card.ex:58 #: lib/cannery_web/live/container_live/show.html.heex:27 #, elixir-autogen, elixir-format msgid "Packs:" diff --git a/priv/gettext/fr/LC_MESSAGES/default.po b/priv/gettext/fr/LC_MESSAGES/default.po index 69ded1a..0816e5e 100644 --- a/priv/gettext/fr/LC_MESSAGES/default.po +++ b/priv/gettext/fr/LC_MESSAGES/default.po @@ -155,7 +155,7 @@ msgstr "Quantité :" msgid "Description" msgstr "Description" -#: lib/cannery_web/components/container_card.ex:30 +#: lib/cannery_web/components/container_card.ex:39 #: lib/cannery_web/live/container_live/show.html.heex:8 #, elixir-autogen, elixir-format msgid "Description:" @@ -244,7 +244,7 @@ msgstr "Me garder authentifié durant 60 jours" msgid "Location" msgstr "Localisation" -#: lib/cannery_web/components/container_card.ex:42 +#: lib/cannery_web/components/container_card.ex:51 #: lib/cannery_web/live/container_live/show.html.heex:20 #, elixir-autogen, elixir-format msgid "Location:" @@ -457,7 +457,7 @@ msgstr "Traceuse" msgid "Type" msgstr "Type" -#: lib/cannery_web/components/container_card.ex:36 +#: lib/cannery_web/components/container_card.ex:45 #: lib/cannery_web/live/container_live/show.html.heex:14 #, elixir-autogen, elixir-format msgid "Type:" @@ -694,7 +694,7 @@ msgstr "Éditer %{name}" msgid "Edit %{name} tags" msgstr "Éditer les tags de %{name}" -#: lib/cannery_web/components/container_card.ex:54 +#: lib/cannery_web/components/container_card.ex:63 #: lib/cannery_web/live/container_live/show.html.heex:32 #, elixir-autogen, elixir-format msgid "Rounds:" @@ -888,7 +888,7 @@ msgstr "Montrer le type de munition" msgid "This ammo is not in a container" msgstr "Ce groupe de munition n’est pas dans un conteneur" -#: lib/cannery_web/components/container_card.ex:49 +#: lib/cannery_web/components/container_card.ex:58 #: lib/cannery_web/live/container_live/show.html.heex:27 #, elixir-autogen, elixir-format msgid "Packs:" diff --git a/priv/gettext/ga/LC_MESSAGES/default.po b/priv/gettext/ga/LC_MESSAGES/default.po index 9a6e8c9..df40791 100644 --- a/priv/gettext/ga/LC_MESSAGES/default.po +++ b/priv/gettext/ga/LC_MESSAGES/default.po @@ -151,7 +151,7 @@ msgstr "" msgid "Description" msgstr "" -#: lib/cannery_web/components/container_card.ex:30 +#: lib/cannery_web/components/container_card.ex:39 #: lib/cannery_web/live/container_live/show.html.heex:8 #, elixir-autogen, elixir-format msgid "Description:" @@ -240,7 +240,7 @@ msgstr "" msgid "Location" msgstr "" -#: lib/cannery_web/components/container_card.ex:42 +#: lib/cannery_web/components/container_card.ex:51 #: lib/cannery_web/live/container_live/show.html.heex:20 #, elixir-autogen, elixir-format msgid "Location:" @@ -449,7 +449,7 @@ msgstr "" msgid "Type" msgstr "" -#: lib/cannery_web/components/container_card.ex:36 +#: lib/cannery_web/components/container_card.ex:45 #: lib/cannery_web/live/container_live/show.html.heex:14 #, elixir-autogen, elixir-format msgid "Type:" @@ -686,7 +686,7 @@ msgstr "" msgid "Edit %{name} tags" msgstr "" -#: lib/cannery_web/components/container_card.ex:54 +#: lib/cannery_web/components/container_card.ex:63 #: lib/cannery_web/live/container_live/show.html.heex:32 #, elixir-autogen, elixir-format msgid "Rounds:" @@ -880,7 +880,7 @@ msgstr "" msgid "This ammo is not in a container" msgstr "" -#: lib/cannery_web/components/container_card.ex:49 +#: lib/cannery_web/components/container_card.ex:58 #: lib/cannery_web/live/container_live/show.html.heex:27 #, elixir-autogen, elixir-format msgid "Packs:"