Included published releases count in record details pages

This commit is contained in:
Claudio Ortolina
2025-02-06 11:37:55 +00:00
parent a6c8b39947
commit b80a98a881
4 changed files with 34 additions and 8 deletions
+4
View File
@@ -70,6 +70,10 @@ defmodule MusicLibrary.Records.Record do
Enum.count(record.included_release_group_ids)
end
def release_count(record) do
Enum.count(record.release_ids)
end
def add_artists(record, artists_attrs) do
record
|> change()
@@ -204,6 +204,14 @@
{Records.Record.format_as_date(@record.purchased_at)}
</dd>
</div>
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
<dt class="text-xs md:text-sm font-medium leading-6 text-zinc-900 dark:text-zinc-400">
{gettext("Published releases")}
</dt>
<dd class="mt-1 text-xs md:text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
{Records.Record.release_count(@record)}
</dd>
</div>
<div
:if={Records.Record.child_release_groups_count(@record) > 0}
class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"
@@ -216,6 +216,14 @@
</button>
</dd>
</div>
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
<dt class="text-xs md:text-sm font-medium leading-6 text-zinc-900 dark:text-zinc-400">
{gettext("Published releases")}
</dt>
<dd class="mt-1 text-xs md:text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
{Records.Record.release_count(@record)}
</dd>
</div>
<div
:if={Records.Record.child_release_groups_count(@record) > 0}
class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"
+14 -8
View File
@@ -101,8 +101,8 @@ msgstr ""
msgid "Import"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:224
#: lib/music_library_web/live/wishlist_live/show.html.heex:236
#: lib/music_library_web/live/collection_live/show.html.heex:232
#: lib/music_library_web/live/wishlist_live/show.html.heex:244
#, elixir-autogen, elixir-format
msgid "Inserted at"
msgstr ""
@@ -285,8 +285,8 @@ msgstr ""
msgid "Types"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:232
#: lib/music_library_web/live/wishlist_live/show.html.heex:244
#: lib/music_library_web/live/collection_live/show.html.heex:240
#: lib/music_library_web/live/wishlist_live/show.html.heex:252
#, elixir-autogen, elixir-format
msgid "Updated at"
msgstr ""
@@ -326,8 +326,8 @@ msgstr ""
msgid "Copy MusicBrainz ID to clipboard"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:243
#: lib/music_library_web/live/wishlist_live/show.html.heex:255
#: lib/music_library_web/live/collection_live/show.html.heex:251
#: lib/music_library_web/live/wishlist_live/show.html.heex:263
#, elixir-autogen, elixir-format
msgid "MusicBrainz data"
msgstr ""
@@ -359,8 +359,8 @@ msgstr ""
msgid "Number of included records"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:212
#: lib/music_library_web/live/wishlist_live/show.html.heex:224
#: lib/music_library_web/live/collection_live/show.html.heex:220
#: lib/music_library_web/live/wishlist_live/show.html.heex:232
#, elixir-autogen, elixir-format
msgid "Includes"
msgstr ""
@@ -613,3 +613,9 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Record added to the collection"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:209
#: lib/music_library_web/live/wishlist_live/show.html.heex:221
#, elixir-autogen, elixir-format
msgid "Published releases"
msgstr ""