add attrs to container card

This commit is contained in:
shibao 2022-11-09 21:18:29 -05:00
parent 9420337228
commit d86f5a6d98
7 changed files with 42 additions and 35 deletions

View File

@ -5,11 +5,20 @@ defmodule CanneryWeb.Components.ContainerCard do
use CanneryWeb, :component use CanneryWeb, :component
import CanneryWeb.Components.TagCard import CanneryWeb.Components.TagCard
alias Cannery.{Containers, Repo} alias Cannery.{Containers, Containers.Container, Repo}
alias CanneryWeb.Endpoint 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 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""" ~H"""
<div <div
@ -63,9 +72,7 @@ defmodule CanneryWeb.Components.ContainerCard do
<% end %> <% end %>
<% end %> <% end %>
<%= if assigns |> Map.has_key?(:tag_actions) do %>
<%= render_slot(@tag_actions) %> <%= render_slot(@tag_actions) %>
<% end %>
</div> </div>
</div> </div>

View File

@ -155,7 +155,7 @@ msgstr "Anzahl:"
msgid "Description" msgid "Description"
msgstr "Beschreibung" 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 #: lib/cannery_web/live/container_live/show.html.heex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Description:" msgid "Description:"
@ -244,7 +244,7 @@ msgstr "Für 60 Tage eingeloggt bleiben"
msgid "Location" msgid "Location"
msgstr "Standort" 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 #: lib/cannery_web/live/container_live/show.html.heex:20
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Location:" msgid "Location:"
@ -455,7 +455,7 @@ msgstr "Leuchtspur"
msgid "Type" msgid "Type"
msgstr "Art" 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 #: lib/cannery_web/live/container_live/show.html.heex:14
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type:" msgid "Type:"
@ -692,7 +692,7 @@ msgstr "%{name} bearbeiten"
msgid "Edit %{name} tags" msgid "Edit %{name} tags"
msgstr "Editiere %{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 #: lib/cannery_web/live/container_live/show.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds:" msgid "Rounds:"
@ -886,7 +886,7 @@ msgstr "Zeige Munitionsarten"
msgid "This ammo is not in a container" msgid "This ammo is not in a container"
msgstr "Diese Munitionsgruppe ist nicht in einem Behälter" 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"

View File

@ -140,7 +140,7 @@ msgstr ""
msgid "Description" msgid "Description"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Description:" msgid "Description:"
@ -229,7 +229,7 @@ msgstr ""
msgid "Location" msgid "Location"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:20
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Location:" msgid "Location:"
@ -438,7 +438,7 @@ msgstr ""
msgid "Type" msgid "Type"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:14
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type:" msgid "Type:"
@ -675,7 +675,7 @@ msgstr ""
msgid "Edit %{name} tags" msgid "Edit %{name} tags"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds:" msgid "Rounds:"
@ -869,7 +869,7 @@ msgstr ""
msgid "This ammo is not in a container" msgid "This ammo is not in a container"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"

View File

@ -141,7 +141,7 @@ msgstr ""
msgid "Description" msgid "Description"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Description:" msgid "Description:"
@ -230,7 +230,7 @@ msgstr ""
msgid "Location" msgid "Location"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:20
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Location:" msgid "Location:"
@ -439,7 +439,7 @@ msgstr ""
msgid "Type" msgid "Type"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:14
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type:" msgid "Type:"
@ -676,7 +676,7 @@ msgstr ""
msgid "Edit %{name} tags" msgid "Edit %{name} tags"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:32
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Rounds:" msgid "Rounds:"
@ -870,7 +870,7 @@ msgstr ""
msgid "This ammo is not in a container" msgid "This ammo is not in a container"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"

View File

@ -155,7 +155,7 @@ msgstr ""
msgid "Description" msgid "Description"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Description:" msgid "Description:"
@ -244,7 +244,7 @@ msgstr ""
msgid "Location" msgid "Location"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:20
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Location:" msgid "Location:"
@ -453,7 +453,7 @@ msgstr ""
msgid "Type" msgid "Type"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:14
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type:" msgid "Type:"
@ -690,7 +690,7 @@ msgstr ""
msgid "Edit %{name} tags" msgid "Edit %{name} tags"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds:" msgid "Rounds:"
@ -884,7 +884,7 @@ msgstr ""
msgid "This ammo is not in a container" msgid "This ammo is not in a container"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"

View File

@ -155,7 +155,7 @@ msgstr "Quantité:"
msgid "Description" msgid "Description"
msgstr "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 #: lib/cannery_web/live/container_live/show.html.heex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Description:" msgid "Description:"
@ -244,7 +244,7 @@ msgstr "Me garder authentifié durant 60 jours"
msgid "Location" msgid "Location"
msgstr "Localisation" 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 #: lib/cannery_web/live/container_live/show.html.heex:20
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Location:" msgid "Location:"
@ -457,7 +457,7 @@ msgstr "Traceuse"
msgid "Type" msgid "Type"
msgstr "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 #: lib/cannery_web/live/container_live/show.html.heex:14
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type:" msgid "Type:"
@ -694,7 +694,7 @@ msgstr "Éditer %{name}"
msgid "Edit %{name} tags" msgid "Edit %{name} tags"
msgstr "Éditer les tags de %{name}" 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 #: lib/cannery_web/live/container_live/show.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds:" msgid "Rounds:"
@ -888,7 +888,7 @@ msgstr "Montrer le type de munition"
msgid "This ammo is not in a container" msgid "This ammo is not in a container"
msgstr "Ce groupe de munition nest pas dans un conteneur" msgstr "Ce groupe de munition nest 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"

View File

@ -151,7 +151,7 @@ msgstr ""
msgid "Description" msgid "Description"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Description:" msgid "Description:"
@ -240,7 +240,7 @@ msgstr ""
msgid "Location" msgid "Location"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:20
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Location:" msgid "Location:"
@ -449,7 +449,7 @@ msgstr ""
msgid "Type" msgid "Type"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:14
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type:" msgid "Type:"
@ -686,7 +686,7 @@ msgstr ""
msgid "Edit %{name} tags" msgid "Edit %{name} tags"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds:" msgid "Rounds:"
@ -880,7 +880,7 @@ msgstr ""
msgid "This ammo is not in a container" msgid "This ammo is not in a container"
msgstr "" 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"