Can refresh cover for a record in the wishlist
This commit is contained in:
@@ -61,6 +61,26 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def handle_event("refresh_cover", %{"id" => id}, socket) do
|
||||||
|
record = Records.get_record!(id)
|
||||||
|
|
||||||
|
case Records.refresh_cover(record) do
|
||||||
|
{:ok, updated_record} ->
|
||||||
|
{:noreply,
|
||||||
|
socket
|
||||||
|
|> put_flash(:info, gettext("Cover refreshed successfully"))
|
||||||
|
|> assign(:record, updated_record)}
|
||||||
|
|
||||||
|
{:error, reason} ->
|
||||||
|
{:noreply,
|
||||||
|
socket
|
||||||
|
|> put_flash(
|
||||||
|
:error,
|
||||||
|
gettext("Error refreshing MusicBrainz data") <> "," <> inspect(reason)
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_info({MusicLibraryWeb.RecordLive.FormComponent, {:saved, record}}, socket) do
|
def handle_info({MusicLibraryWeb.RecordLive.FormComponent, {:saved, record}}, socket) do
|
||||||
{:noreply, assign(socket, :record, record)}
|
{:noreply, assign(socket, :record, record)}
|
||||||
|
|||||||
@@ -32,6 +32,11 @@
|
|||||||
<%= gettext("Edit") %>
|
<%= gettext("Edit") %>
|
||||||
</.button>
|
</.button>
|
||||||
</.link>
|
</.link>
|
||||||
|
<.link phx-click={JS.push("refresh_cover", value: %{id: @record.id})}>
|
||||||
|
<.button type="button" class="relative -ml-px inline-flex items-center rounded-none">
|
||||||
|
<%= gettext("Refresh Cover") %>
|
||||||
|
</.button>
|
||||||
|
</.link>
|
||||||
<.link phx-click={JS.push("refresh_musicbrainz_data", value: %{id: @record.id})}>
|
<.link phx-click={JS.push("refresh_musicbrainz_data", value: %{id: @record.id})}>
|
||||||
<.button type="button" class="relative -ml-px inline-flex items-center rounded-none">
|
<.button type="button" class="relative -ml-px inline-flex items-center rounded-none">
|
||||||
<%= gettext("Refresh MB Data") %>
|
<%= gettext("Refresh MB Data") %>
|
||||||
|
|||||||
+16
-13
@@ -19,7 +19,7 @@ msgstr ""
|
|||||||
#: lib/music_library_web/live/record_live/index.html.heex:185
|
#: lib/music_library_web/live/record_live/index.html.heex:185
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:47
|
#: lib/music_library_web/live/record_live/show.html.heex:47
|
||||||
#: lib/music_library_web/live/wishlist_live/index.html.heex:195
|
#: lib/music_library_web/live/wishlist_live/index.html.heex:195
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:42
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:47
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Are you sure?"
|
msgid "Are you sure?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -34,7 +34,7 @@ msgstr ""
|
|||||||
msgid "Back to records"
|
msgid "Back to records"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:128
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:133
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Back to wishlist"
|
msgid "Back to wishlist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -64,7 +64,7 @@ msgstr ""
|
|||||||
#: lib/music_library_web/live/record_live/index.html.heex:187
|
#: lib/music_library_web/live/record_live/index.html.heex:187
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:53
|
#: lib/music_library_web/live/record_live/show.html.heex:53
|
||||||
#: lib/music_library_web/live/wishlist_live/index.html.heex:197
|
#: lib/music_library_web/live/wishlist_live/index.html.heex:197
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:48
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:53
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Delete"
|
msgid "Delete"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -75,7 +75,7 @@ msgstr ""
|
|||||||
#: lib/music_library_web/live/record_live/show.html.heex:32
|
#: lib/music_library_web/live/record_live/show.html.heex:32
|
||||||
#: lib/music_library_web/live/wishlist_live/index.ex:55
|
#: lib/music_library_web/live/wishlist_live/index.ex:55
|
||||||
#: lib/music_library_web/live/wishlist_live/index.html.heex:176
|
#: lib/music_library_web/live/wishlist_live/index.html.heex:176
|
||||||
#: lib/music_library_web/live/wishlist_live/show.ex:70
|
#: lib/music_library_web/live/wishlist_live/show.ex:90
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:32
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:32
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Edit"
|
msgid "Edit"
|
||||||
@@ -106,7 +106,7 @@ msgid "Formats"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:62
|
#: lib/music_library_web/live/record_live/show.html.heex:62
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:58
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:63
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Genres"
|
msgid "Genres"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -129,7 +129,7 @@ msgid "Import from MusicBrainz"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:115
|
#: lib/music_library_web/live/record_live/show.html.heex:115
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:103
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:108
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Inserted at"
|
msgid "Inserted at"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -156,7 +156,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: lib/music_library_web/live/record_live/form_component.ex:46
|
#: lib/music_library_web/live/record_live/form_component.ex:46
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:70
|
#: lib/music_library_web/live/record_live/show.html.heex:70
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:66
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:71
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "MusicBrainz ID"
|
msgid "MusicBrainz ID"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -257,7 +257,7 @@ msgstr ""
|
|||||||
#: lib/music_library_web/live/record_live/index.html.heex:156
|
#: lib/music_library_web/live/record_live/index.html.heex:156
|
||||||
#: lib/music_library_web/live/record_live/show.ex:91
|
#: lib/music_library_web/live/record_live/show.ex:91
|
||||||
#: lib/music_library_web/live/wishlist_live/index.html.heex:156
|
#: lib/music_library_web/live/wishlist_live/index.html.heex:156
|
||||||
#: lib/music_library_web/live/wishlist_live/show.ex:69
|
#: lib/music_library_web/live/wishlist_live/show.ex:89
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Show"
|
msgid "Show"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -313,7 +313,7 @@ msgid "Types"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:123
|
#: lib/music_library_web/live/record_live/show.html.heex:123
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:111
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:116
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Updated at"
|
msgid "Updated at"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -352,13 +352,13 @@ msgid "close"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:80
|
#: lib/music_library_web/live/record_live/show.html.heex:80
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:76
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:81
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Copy MusicBrainz ID to clipboard"
|
msgid "Copy MusicBrainz ID to clipboard"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:134
|
#: lib/music_library_web/live/record_live/show.html.heex:134
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:122
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:127
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "MusicBrainz data"
|
msgid "MusicBrainz data"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -392,7 +392,7 @@ msgid "Number of included records"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:103
|
#: lib/music_library_web/live/record_live/show.html.heex:103
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:91
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:96
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Includes"
|
msgid "Includes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -400,6 +400,7 @@ msgstr ""
|
|||||||
#: lib/music_library_web/live/record_live/show.ex:61
|
#: lib/music_library_web/live/record_live/show.ex:61
|
||||||
#: lib/music_library_web/live/record_live/show.ex:81
|
#: lib/music_library_web/live/record_live/show.ex:81
|
||||||
#: lib/music_library_web/live/wishlist_live/show.ex:59
|
#: lib/music_library_web/live/wishlist_live/show.ex:59
|
||||||
|
#: lib/music_library_web/live/wishlist_live/show.ex:79
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Error refreshing MusicBrainz data"
|
msgid "Error refreshing MusicBrainz data"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -411,7 +412,7 @@ msgid "MusicBrainz data refreshed successfully"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:42
|
#: lib/music_library_web/live/record_live/show.html.heex:42
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:37
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:42
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Refresh MB Data"
|
msgid "Refresh MB Data"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -422,11 +423,13 @@ msgid "Refresh LastFm Feed"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.ex:73
|
#: lib/music_library_web/live/record_live/show.ex:73
|
||||||
|
#: lib/music_library_web/live/wishlist_live/show.ex:71
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Cover refreshed successfully"
|
msgid "Cover refreshed successfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:37
|
#: lib/music_library_web/live/record_live/show.html.heex:37
|
||||||
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:37
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Refresh Cover"
|
msgid "Refresh Cover"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
Reference in New Issue
Block a user