Remove duplication around MusicBrainz URL generation

This commit is contained in:
Claudio Ortolina
2024-12-11 23:54:21 +03:00
parent 3409ba6d6b
commit 91b81de0f8
6 changed files with 7 additions and 15 deletions
@@ -145,10 +145,6 @@ defmodule MusicLibraryWeb.CollectionLive.Show do
defp title_segment(:show), do: gettext("Show")
defp title_segment(:edit), do: gettext("Edit")
defp musicbrainz_url(record) do
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
end
defp human_datetime(dt) do
"#{dt.day}/#{dt.month}/#{dt.year}"
end
@@ -103,7 +103,7 @@
{gettext("MusicBrainz ID")}
</dt>
<dd class="mt-1 text-sm flex justify-between leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
<a href={musicbrainz_url(@record)}>
<a href={MusicBrainz.ReleaseGroup.url(@record.musicbrainz_id)}>
<code id={"mb-#{@record.musicbrainz_id}"}>{@record.musicbrainz_id}</code>
</a>
<button phx-click={
@@ -128,10 +128,6 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
defp title_segment(:show), do: gettext("Show")
defp title_segment(:edit), do: gettext("Edit")
defp musicbrainz_url(record) do
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
end
defp human_datetime(dt) do
"#{dt.day}/#{dt.month}/#{dt.year}"
end
@@ -104,7 +104,7 @@
{gettext("MusicBrainz ID")}
</dt>
<dd class="mt-1 text-sm flex justify-between leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
<a href={musicbrainz_url(@record)}>
<a href={MusicBrainz.ReleaseGroup.url(@record.musicbrainz_id)}>
<code id={"mb-#{@record.musicbrainz_id}"}>{@record.musicbrainz_id}</code>
</a>
<button phx-click={