Show included release groups in record show page

This commit is contained in:
Claudio Ortolina
2024-11-14 19:11:41 +00:00
parent edd1339287
commit d7fd14c7ab
3 changed files with 27 additions and 4 deletions
+3
View File
@@ -61,6 +61,9 @@ defmodule MusicLibrary.Records.Record do
relation["type"] == "included in" and
relation["direction"] == "backward"
end)
|> Enum.map(fn relation ->
MusicBrainz.ReleaseGroup.from_api_response(relation["release_group"])
end)
end
def child_release_groups_count(record) do
@@ -82,6 +82,21 @@
<%= human_datetime(@record.purchased_at) %>
</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"
>
<dt class="text-sm font-medium leading-6 text-zinc-900 dark:text-zinc-400">
<%= gettext("Includes") %>
</dt>
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
<ul>
<li :for={child_release_group <- Records.Record.child_release_groups(@record)}>
<%= child_release_group.artists %> - <%= child_release_group.title %>
</li>
</ul>
</dd>
</div>
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
<dt class="text-sm font-medium leading-6 text-zinc-900 dark:text-zinc-400">
<%= gettext("Inserted at") %>
+9 -4
View File
@@ -29,7 +29,7 @@ msgstr ""
msgid "Attempting to reconnect"
msgstr ""
#: lib/music_library_web/live/record_live/show.html.heex:112
#: lib/music_library_web/live/record_live/show.html.heex:127
#, elixir-autogen, elixir-format
msgid "Back to records"
msgstr ""
@@ -128,7 +128,7 @@ msgstr ""
msgid "Import from MusicBrainz"
msgstr ""
#: lib/music_library_web/live/record_live/show.html.heex:87
#: lib/music_library_web/live/record_live/show.html.heex:102
#: lib/music_library_web/live/wishlist_live/show.html.heex:80
#, elixir-autogen, elixir-format
msgid "Inserted at"
@@ -311,7 +311,7 @@ msgstr ""
msgid "Types"
msgstr ""
#: lib/music_library_web/live/record_live/show.html.heex:95
#: lib/music_library_web/live/record_live/show.html.heex:110
#: lib/music_library_web/live/wishlist_live/show.html.heex:88
#, elixir-autogen, elixir-format
msgid "Updated at"
@@ -356,7 +356,7 @@ msgstr ""
msgid "Copy MusicBrainz ID to clipboard"
msgstr ""
#: lib/music_library_web/live/record_live/show.html.heex:106
#: lib/music_library_web/live/record_live/show.html.heex:121
#: lib/music_library_web/live/wishlist_live/show.html.heex:99
#, elixir-autogen, elixir-format
msgid "MusicBrainz data"
@@ -389,3 +389,8 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Number of included records"
msgstr ""
#: lib/music_library_web/live/record_live/show.html.heex:90
#, elixir-autogen, elixir-format
msgid "Includes"
msgstr ""