Show purchase date in collection view
This commit is contained in:
@@ -228,6 +228,10 @@ defmodule MusicLibrary.Records.Record do
|
||||
end
|
||||
end
|
||||
|
||||
def format_purchased_at(purchased_at) do
|
||||
"#{purchased_at.day}/#{purchased_at.month}/#{purchased_at.year}"
|
||||
end
|
||||
|
||||
defp parse_subtype("Album"), do: :album
|
||||
defp parse_subtype("EP"), do: :ep
|
||||
defp parse_subtype("Live"), do: :live
|
||||
|
||||
@@ -63,6 +63,19 @@ defmodule MusicLibraryWeb.RecordComponents do
|
||||
{Records.Record.child_release_groups_count(record)}
|
||||
</span>
|
||||
</span>
|
||||
<span :if={record.purchased_at}>
|
||||
·
|
||||
<span class="sr-only">
|
||||
{gettext("Purchased on")}
|
||||
</span>
|
||||
<.icon
|
||||
name="hero-banknotes"
|
||||
class="-mt-1 h-4 w-4"
|
||||
aria-hidden="true"
|
||||
data-slot="icon"
|
||||
/>
|
||||
{Records.Record.format_purchased_at(record.purchased_at)}
|
||||
</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
@@ -90,6 +103,13 @@ defmodule MusicLibraryWeb.RecordComponents do
|
||||
</span>
|
||||
</span>
|
||||
</p>
|
||||
<p :if={record.purchased_at} class="text-xs leading-6 text-zinc-900 dark:text-zinc-300">
|
||||
<span class="sr-only">
|
||||
{gettext("Purchased on")}
|
||||
</span>
|
||||
<.icon name="hero-banknotes" class="-mt-1 h-4 w-4" aria-hidden="true" data-slot="icon" />
|
||||
{Records.Record.format_purchased_at(record.purchased_at)}
|
||||
</p>
|
||||
</div>
|
||||
<%!-- TODO: replace with OSS version --%>
|
||||
<div class="relative flex-none">
|
||||
|
||||
@@ -16,7 +16,7 @@ msgstr ""
|
||||
msgid "Actions"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex:179
|
||||
#: lib/music_library_web/components/record_components.ex:199
|
||||
#: lib/music_library_web/live/collection_live/show.html.heex:127
|
||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:144
|
||||
#, elixir-autogen, elixir-format
|
||||
@@ -43,14 +43,14 @@ msgstr ""
|
||||
msgid "Cover art"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex:181
|
||||
#: lib/music_library_web/components/record_components.ex:201
|
||||
#: lib/music_library_web/live/collection_live/show.html.heex:135
|
||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:152
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex:159
|
||||
#: lib/music_library_web/components/record_components.ex:179
|
||||
#: lib/music_library_web/live/collection_live/show.ex:139
|
||||
#: lib/music_library_web/live/collection_live/show.html.heex:70
|
||||
#: lib/music_library_web/live/wishlist_live/show.ex:136
|
||||
@@ -151,7 +151,7 @@ msgstr ""
|
||||
msgid "No results"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex:104
|
||||
#: lib/music_library_web/components/record_components.ex:124
|
||||
#: lib/music_library_web/live/collection_live/show.html.heex:38
|
||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:38
|
||||
#, elixir-autogen, elixir-format
|
||||
@@ -169,7 +169,7 @@ msgstr ""
|
||||
msgid "Previous"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex:170
|
||||
#: lib/music_library_web/components/record_components.ex:190
|
||||
#: lib/music_library_web/live/collection_live/index.html.heex:42
|
||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:135
|
||||
#, elixir-autogen, elixir-format
|
||||
@@ -181,6 +181,8 @@ msgstr ""
|
||||
msgid "Purchased at"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex:69
|
||||
#: lib/music_library_web/components/record_components.ex:108
|
||||
#: lib/music_library_web/live/collection_live/show.html.heex:181
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Purchased on"
|
||||
@@ -215,7 +217,7 @@ msgstr ""
|
||||
msgid "Saving..."
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex:201
|
||||
#: lib/music_library_web/components/record_components.ex:221
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
@@ -230,7 +232,7 @@ msgstr ""
|
||||
msgid "Search for records"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex:139
|
||||
#: lib/music_library_web/components/record_components.ex:159
|
||||
#: lib/music_library_web/live/collection_live/show.ex:138
|
||||
#: lib/music_library_web/live/wishlist_live/show.ex:135
|
||||
#, elixir-autogen, elixir-format
|
||||
@@ -293,7 +295,7 @@ msgstr ""
|
||||
msgid "Updated at"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex:149
|
||||
#: lib/music_library_web/components/record_components.ex:169
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "View on MusicBrainz"
|
||||
msgstr ""
|
||||
@@ -356,7 +358,7 @@ msgid "Wishlisted"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex:53
|
||||
#: lib/music_library_web/components/record_components.ex:79
|
||||
#: lib/music_library_web/components/record_components.ex:92
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Number of included records"
|
||||
msgstr ""
|
||||
|
||||
@@ -69,6 +69,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|
||||
assert record_row_html =~ Record.type_long_label(record.type)
|
||||
assert record_row_html =~ record.release
|
||||
assert record_row_html =~ ~p"/covers/#{record.id}?vsn=#{record.cover_hash}"
|
||||
assert record_row_html =~ Record.format_purchased_at(record.purchased_at)
|
||||
|
||||
for artist <- record.artists do
|
||||
assert record_row_html =~ escape(artist.name)
|
||||
|
||||
Reference in New Issue
Block a user