Show purchase date in collection view
This commit is contained in:
@@ -228,6 +228,10 @@ defmodule MusicLibrary.Records.Record do
|
|||||||
end
|
end
|
||||||
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("Album"), do: :album
|
||||||
defp parse_subtype("EP"), do: :ep
|
defp parse_subtype("EP"), do: :ep
|
||||||
defp parse_subtype("Live"), do: :live
|
defp parse_subtype("Live"), do: :live
|
||||||
|
|||||||
@@ -63,6 +63,19 @@ defmodule MusicLibraryWeb.RecordComponents do
|
|||||||
{Records.Record.child_release_groups_count(record)}
|
{Records.Record.child_release_groups_count(record)}
|
||||||
</span>
|
</span>
|
||||||
</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>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -90,6 +103,13 @@ defmodule MusicLibraryWeb.RecordComponents do
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</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>
|
</div>
|
||||||
<%!-- TODO: replace with OSS version --%>
|
<%!-- TODO: replace with OSS version --%>
|
||||||
<div class="relative flex-none">
|
<div class="relative flex-none">
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ msgstr ""
|
|||||||
msgid "Actions"
|
msgid "Actions"
|
||||||
msgstr ""
|
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/collection_live/show.html.heex:127
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:144
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:144
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
@@ -43,14 +43,14 @@ msgstr ""
|
|||||||
msgid "Cover art"
|
msgid "Cover art"
|
||||||
msgstr ""
|
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/collection_live/show.html.heex:135
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:152
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:152
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Delete"
|
msgid "Delete"
|
||||||
msgstr ""
|
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.ex:139
|
||||||
#: lib/music_library_web/live/collection_live/show.html.heex:70
|
#: lib/music_library_web/live/collection_live/show.html.heex:70
|
||||||
#: lib/music_library_web/live/wishlist_live/show.ex:136
|
#: lib/music_library_web/live/wishlist_live/show.ex:136
|
||||||
@@ -151,7 +151,7 @@ msgstr ""
|
|||||||
msgid "No results"
|
msgid "No results"
|
||||||
msgstr ""
|
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/collection_live/show.html.heex:38
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:38
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:38
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
@@ -169,7 +169,7 @@ msgstr ""
|
|||||||
msgid "Previous"
|
msgid "Previous"
|
||||||
msgstr ""
|
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/collection_live/index.html.heex:42
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:135
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:135
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
@@ -181,6 +181,8 @@ msgstr ""
|
|||||||
msgid "Purchased at"
|
msgid "Purchased at"
|
||||||
msgstr ""
|
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
|
#: lib/music_library_web/live/collection_live/show.html.heex:181
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Purchased on"
|
msgid "Purchased on"
|
||||||
@@ -215,7 +217,7 @@ msgstr ""
|
|||||||
msgid "Saving..."
|
msgid "Saving..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/record_components.ex:201
|
#: lib/music_library_web/components/record_components.ex:221
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Search"
|
msgid "Search"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -230,7 +232,7 @@ msgstr ""
|
|||||||
msgid "Search for records"
|
msgid "Search for records"
|
||||||
msgstr ""
|
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/collection_live/show.ex:138
|
||||||
#: lib/music_library_web/live/wishlist_live/show.ex:135
|
#: lib/music_library_web/live/wishlist_live/show.ex:135
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
@@ -293,7 +295,7 @@ msgstr ""
|
|||||||
msgid "Updated at"
|
msgid "Updated at"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/record_components.ex:149
|
#: lib/music_library_web/components/record_components.ex:169
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "View on MusicBrainz"
|
msgid "View on MusicBrainz"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -356,7 +358,7 @@ msgid "Wishlisted"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/record_components.ex:53
|
#: 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
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Number of included records"
|
msgid "Number of included records"
|
||||||
msgstr ""
|
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.type_long_label(record.type)
|
||||||
assert record_row_html =~ record.release
|
assert record_row_html =~ record.release
|
||||||
assert record_row_html =~ ~p"/covers/#{record.id}?vsn=#{record.cover_hash}"
|
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
|
for artist <- record.artists do
|
||||||
assert record_row_html =~ escape(artist.name)
|
assert record_row_html =~ escape(artist.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user