From d7fd14c7abba380b900b23dc2f589499697cf1ab Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Thu, 14 Nov 2024 19:11:41 +0000 Subject: [PATCH] Show included release groups in record show page --- lib/music_library/records/record.ex | 3 +++ .../live/record_live/show.html.heex | 15 +++++++++++++++ priv/gettext/default.pot | 13 +++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/lib/music_library/records/record.ex b/lib/music_library/records/record.ex index cac951ba..62cd163b 100644 --- a/lib/music_library/records/record.ex +++ b/lib/music_library/records/record.ex @@ -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 diff --git a/lib/music_library_web/live/record_live/show.html.heex b/lib/music_library_web/live/record_live/show.html.heex index 532153e7..653cfd1e 100644 --- a/lib/music_library_web/live/record_live/show.html.heex +++ b/lib/music_library_web/live/record_live/show.html.heex @@ -82,6 +82,21 @@ <%= human_datetime(@record.purchased_at) %> +
0} + class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0" + > +
+ <%= gettext("Includes") %> +
+
+
    +
  • + <%= child_release_group.artists %> - <%= child_release_group.title %> +
  • +
+
+
<%= gettext("Inserted at") %> diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index fd2344b2..3176effd 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -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 ""