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) Enum.count(record.included_release_group_ids)
end end
def release_count(record) do
Enum.count(record.release_ids)
end
def add_artists(record, artists_attrs) do def add_artists(record, artists_attrs) do
record record
|> change() |> change()
@@ -204,6 +204,14 @@
{Records.Record.format_as_date(@record.purchased_at)} {Records.Record.format_as_date(@record.purchased_at)}
</dd> </dd>
</div> </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 <div
:if={Records.Record.child_release_groups_count(@record) > 0} :if={Records.Record.child_release_groups_count(@record) > 0}
class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0" class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"
@@ -216,6 +216,14 @@
</button> </button>
</dd> </dd>
</div> </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 <div
:if={Records.Record.child_release_groups_count(@record) > 0} :if={Records.Record.child_release_groups_count(@record) > 0}
class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-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" msgid "Import"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:224 #: lib/music_library_web/live/collection_live/show.html.heex:232
#: lib/music_library_web/live/wishlist_live/show.html.heex:236 #: lib/music_library_web/live/wishlist_live/show.html.heex:244
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Inserted at" msgid "Inserted at"
msgstr "" msgstr ""
@@ -285,8 +285,8 @@ msgstr ""
msgid "Types" msgid "Types"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:232 #: lib/music_library_web/live/collection_live/show.html.heex:240
#: lib/music_library_web/live/wishlist_live/show.html.heex:244 #: lib/music_library_web/live/wishlist_live/show.html.heex:252
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Updated at" msgid "Updated at"
msgstr "" msgstr ""
@@ -326,8 +326,8 @@ msgstr ""
msgid "Copy MusicBrainz ID to clipboard" msgid "Copy MusicBrainz ID to clipboard"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:243 #: lib/music_library_web/live/collection_live/show.html.heex:251
#: lib/music_library_web/live/wishlist_live/show.html.heex:255 #: lib/music_library_web/live/wishlist_live/show.html.heex:263
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "MusicBrainz data" msgid "MusicBrainz data"
msgstr "" msgstr ""
@@ -359,8 +359,8 @@ msgstr ""
msgid "Number of included records" msgid "Number of included records"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:212 #: lib/music_library_web/live/collection_live/show.html.heex:220
#: lib/music_library_web/live/wishlist_live/show.html.heex:224 #: lib/music_library_web/live/wishlist_live/show.html.heex:232
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Includes" msgid "Includes"
msgstr "" msgstr ""
@@ -613,3 +613,9 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record added to the collection" msgid "Record added to the collection"
msgstr "" 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 ""