forked from shibao/cannery
		
	add attrs to container card
This commit is contained in:
		@@ -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"""
 | 
			
		||||
    <div
 | 
			
		||||
@@ -63,9 +72,7 @@ defmodule CanneryWeb.Components.ContainerCard do
 | 
			
		||||
            <% end %>
 | 
			
		||||
          <% end %>
 | 
			
		||||
 | 
			
		||||
          <%= if assigns |> Map.has_key?(:tag_actions) do %>
 | 
			
		||||
          <%= render_slot(@tag_actions) %>
 | 
			
		||||
          <% end %>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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:"
 | 
			
		||||
 
 | 
			
		||||
@@ -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:"
 | 
			
		||||
 
 | 
			
		||||
@@ -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:"
 | 
			
		||||
 
 | 
			
		||||
@@ -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:"
 | 
			
		||||
 
 | 
			
		||||
@@ -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:"
 | 
			
		||||
 
 | 
			
		||||
@@ -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:"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user