Show included release groups in record show page
This commit is contained in:
@@ -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") %>
|
||||
|
||||
Reference in New Issue
Block a user