forked from shibao/cannery
show container name in ammo type listing
This commit is contained in:
parent
dbc575d305
commit
2e0bb861f1
@ -1,8 +1,9 @@
|
||||
# v0.5.5
|
||||
- Update translations
|
||||
- Make ammo index page a bit more compact
|
||||
- Add ammo count to ammo type index page
|
||||
- Make ammo catalog page include ammo count
|
||||
- Make ammo type show page a bit more compact
|
||||
- Make ammo type show page include container names for each ammo
|
||||
- Make container show page a bit more compact
|
||||
- Forgot to add the logo as the favicon whoops
|
||||
|
||||
|
@ -7,8 +7,13 @@ defmodule CanneryWeb.Components.AmmoGroupCard do
|
||||
alias Cannery.Repo
|
||||
alias CanneryWeb.Endpoint
|
||||
|
||||
def ammo_group_card(assigns) do
|
||||
assigns = assigns |> assign(:ammo_group, assigns.ammo_group |> Repo.preload(:ammo_type))
|
||||
def ammo_group_card(%{ammo_group: ammo_group} = assigns) do
|
||||
assigns =
|
||||
%{show_container: show_container} = assigns |> assign_new(:show_container, fn -> false end)
|
||||
|
||||
preloads = if show_container, do: [:ammo_type, :container], else: [:ammo_type]
|
||||
ammo_group = ammo_group |> Repo.preload(preloads)
|
||||
assigns = assigns |> assign(:ammo_group, ammo_group)
|
||||
|
||||
~H"""
|
||||
<div
|
||||
@ -17,7 +22,7 @@ defmodule CanneryWeb.Components.AmmoGroupCard do
|
||||
border border-gray-400 rounded-lg shadow-lg hover:shadow-md
|
||||
transition-all duration-300 ease-in-out"
|
||||
>
|
||||
<%= live_redirect to: Routes.ammo_group_show_path(Endpoint, :show, @ammo_group),
|
||||
<%= live_patch to: Routes.ammo_group_show_path(Endpoint, :show, @ammo_group),
|
||||
class: "mb-2 link" do %>
|
||||
<h1 class="title text-xl title-primary-500">
|
||||
<%= @ammo_group.ammo_type.name %>
|
||||
@ -50,6 +55,17 @@ defmodule CanneryWeb.Components.AmmoGroupCard do
|
||||
) %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
<%= if @show_container and @ammo_group.container do %>
|
||||
<span class="rounded-lg title text-lg">
|
||||
<%= gettext("Container:") %>
|
||||
|
||||
<%= live_patch to: Routes.container_show_path(Endpoint, :show, @ammo_group.container),
|
||||
class: "link" do %>
|
||||
<%= @ammo_group.container.name %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= if assigns |> Map.has_key?(:inner_block) do %>
|
||||
|
@ -122,7 +122,7 @@
|
||||
<% else %>
|
||||
<div class="flex flex-wrap justify-center items-center">
|
||||
<%= for ammo_group <- @ammo_groups do %>
|
||||
<.ammo_group_card ammo_group={ammo_group} />
|
||||
<.ammo_group_card ammo_group={ammo_group} show_container={true} />
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -144,7 +144,7 @@ msgid "Count"
|
||||
msgstr "Anzahl"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:29
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:34
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:8
|
||||
msgid "Count:"
|
||||
msgstr "Anzahl:"
|
||||
@ -352,7 +352,7 @@ msgid "Notes"
|
||||
msgstr "Bemerkungen"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:35
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:40
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:24
|
||||
msgid "Notes:"
|
||||
msgstr "Bemerkungen:"
|
||||
@ -376,7 +376,7 @@ msgid "Price paid"
|
||||
msgstr "Kaufpreis"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:47
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:52
|
||||
msgid "Price paid:"
|
||||
msgstr "Kaufpreis:"
|
||||
|
||||
@ -616,7 +616,7 @@ msgid "Shot log"
|
||||
msgstr "Schießkladde"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:48
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:53
|
||||
#: lib/cannery_web/live/ammo_group_live/index.ex:125
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
|
||||
@ -829,7 +829,7 @@ msgid "Added on"
|
||||
msgstr "Hinzugefügt am"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:41
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:46
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:30
|
||||
#: lib/cannery_web/live/ammo_type_live/show.html.heex:90
|
||||
msgid "Added on:"
|
||||
@ -940,3 +940,8 @@ msgstr ""
|
||||
#: lib/cannery_web/live/ammo_type_live/index.ex:87
|
||||
msgid "Total # of ammo"
|
||||
msgstr "Summe aller Patronen"
|
||||
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:61
|
||||
msgid "Container:"
|
||||
msgstr "Behälter"
|
||||
|
@ -129,7 +129,7 @@ msgid "Count"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:29
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:34
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:8
|
||||
msgid "Count:"
|
||||
msgstr ""
|
||||
@ -337,7 +337,7 @@ msgid "Notes"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:35
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:40
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:24
|
||||
msgid "Notes:"
|
||||
msgstr ""
|
||||
@ -361,7 +361,7 @@ msgid "Price paid"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:47
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:52
|
||||
msgid "Price paid:"
|
||||
msgstr ""
|
||||
|
||||
@ -599,7 +599,7 @@ msgid "Shot log"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:48
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:53
|
||||
#: lib/cannery_web/live/ammo_group_live/index.ex:125
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
|
||||
@ -812,7 +812,7 @@ msgid "Added on"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:41
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:46
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:30
|
||||
#: lib/cannery_web/live/ammo_type_live/show.html.heex:90
|
||||
msgid "Added on:"
|
||||
@ -923,3 +923,8 @@ msgstr ""
|
||||
#: lib/cannery_web/live/ammo_type_live/index.ex:87
|
||||
msgid "Total # of ammo"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:61
|
||||
msgid "Container:"
|
||||
msgstr ""
|
||||
|
@ -130,7 +130,7 @@ msgid "Count"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:29
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:34
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:8
|
||||
msgid "Count:"
|
||||
msgstr ""
|
||||
@ -338,7 +338,7 @@ msgid "Notes"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:35
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:40
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:24
|
||||
msgid "Notes:"
|
||||
msgstr ""
|
||||
@ -362,7 +362,7 @@ msgid "Price paid"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:47
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:52
|
||||
msgid "Price paid:"
|
||||
msgstr ""
|
||||
|
||||
@ -600,7 +600,7 @@ msgid "Shot log"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:48
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:53
|
||||
#: lib/cannery_web/live/ammo_group_live/index.ex:125
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
|
||||
@ -813,7 +813,7 @@ msgid "Added on"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:41
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:46
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:30
|
||||
#: lib/cannery_web/live/ammo_type_live/show.html.heex:90
|
||||
msgid "Added on:"
|
||||
@ -924,3 +924,8 @@ msgstr ""
|
||||
#: lib/cannery_web/live/ammo_type_live/index.ex:87
|
||||
msgid "Total # of ammo"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:61
|
||||
msgid "Container:"
|
||||
msgstr ""
|
||||
|
@ -144,7 +144,7 @@ msgid "Count"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:29
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:34
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:8
|
||||
msgid "Count:"
|
||||
msgstr ""
|
||||
@ -352,7 +352,7 @@ msgid "Notes"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:35
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:40
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:24
|
||||
msgid "Notes:"
|
||||
msgstr ""
|
||||
@ -376,7 +376,7 @@ msgid "Price paid"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:47
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:52
|
||||
msgid "Price paid:"
|
||||
msgstr ""
|
||||
|
||||
@ -614,7 +614,7 @@ msgid "Shot log"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:48
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:53
|
||||
#: lib/cannery_web/live/ammo_group_live/index.ex:125
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
|
||||
@ -827,7 +827,7 @@ msgid "Added on"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:41
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:46
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:30
|
||||
#: lib/cannery_web/live/ammo_type_live/show.html.heex:90
|
||||
msgid "Added on:"
|
||||
@ -938,3 +938,8 @@ msgstr ""
|
||||
#: lib/cannery_web/live/ammo_type_live/index.ex:87
|
||||
msgid "Total # of ammo"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:61
|
||||
msgid "Container:"
|
||||
msgstr ""
|
||||
|
@ -144,7 +144,7 @@ msgid "Count"
|
||||
msgstr "Quantité"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:29
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:34
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:8
|
||||
msgid "Count:"
|
||||
msgstr "Quantité :"
|
||||
@ -352,7 +352,7 @@ msgid "Notes"
|
||||
msgstr "Notes"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:35
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:40
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:24
|
||||
msgid "Notes:"
|
||||
msgstr "Notes :"
|
||||
@ -376,7 +376,7 @@ msgid "Price paid"
|
||||
msgstr "Prix payé"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:47
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:52
|
||||
msgid "Price paid:"
|
||||
msgstr "Prix payé :"
|
||||
|
||||
@ -618,7 +618,7 @@ msgid "Shot log"
|
||||
msgstr "Évènements de tir"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:48
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:53
|
||||
#: lib/cannery_web/live/ammo_group_live/index.ex:125
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:37
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:44
|
||||
@ -831,7 +831,7 @@ msgid "Added on"
|
||||
msgstr "Ajouté le"
|
||||
|
||||
#, elixir-autogen, elixir-format
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:41
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:46
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:30
|
||||
#: lib/cannery_web/live/ammo_type_live/show.html.heex:90
|
||||
msgid "Added on:"
|
||||
@ -942,3 +942,8 @@ msgstr ""
|
||||
#: lib/cannery_web/live/ammo_type_live/index.ex:87
|
||||
msgid "Total # of ammo"
|
||||
msgstr "Quantité de cartouches"
|
||||
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
#: lib/cannery_web/components/ammo_group_card.ex:61
|
||||
msgid "Container:"
|
||||
msgstr "Conteneur"
|
||||
|
Loading…
Reference in New Issue
Block a user