Can refresh data for wishlist records
This commit is contained in:
@@ -41,6 +41,26 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
|
|||||||
{:noreply, push_navigate(socket, to: ~p"/wishlist")}
|
{:noreply, push_navigate(socket, to: ~p"/wishlist")}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def handle_event("refresh_musicbrainz_data", %{"id" => id}, socket) do
|
||||||
|
record = Records.get_record!(id)
|
||||||
|
|
||||||
|
case Records.refresh_musicbrainz_data(record) do
|
||||||
|
{:ok, updated_record} ->
|
||||||
|
{:noreply,
|
||||||
|
socket
|
||||||
|
|> put_flash(:info, gettext("MusicBrainz data 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)}
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
<%= gettext("Edit") %>
|
<%= gettext("Edit") %>
|
||||||
</.button>
|
</.button>
|
||||||
</.link>
|
</.link>
|
||||||
|
<.link phx-click={JS.push("refresh_musicbrainz_data", value: %{id: @record.id})}>
|
||||||
|
<.button>
|
||||||
|
<%= gettext("Refresh MB Data") %>
|
||||||
|
</.button>
|
||||||
|
</.link>
|
||||||
<.link
|
<.link
|
||||||
phx-click={JS.push("delete", value: %{id: @record.id})}
|
phx-click={JS.push("delete", value: %{id: @record.id})}
|
||||||
data-confirm={gettext("Are you sure?")}
|
data-confirm={gettext("Are you sure?")}
|
||||||
|
|||||||
+15
-12
@@ -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:14
|
#: lib/music_library_web/live/record_live/show.html.heex:14
|
||||||
#: 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:9
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:14
|
||||||
#, 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:120
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:125
|
||||||
#, 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:17
|
#: lib/music_library_web/live/record_live/show.html.heex:17
|
||||||
#: 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:12
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:17
|
||||||
#, 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:4
|
#: lib/music_library_web/live/record_live/show.html.heex:4
|
||||||
#: 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:50
|
#: lib/music_library_web/live/wishlist_live/show.ex:70
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:4
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:4
|
||||||
#, 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:54
|
#: lib/music_library_web/live/record_live/show.html.heex:54
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:50
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:55
|
||||||
#, 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:107
|
#: lib/music_library_web/live/record_live/show.html.heex:107
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:95
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:100
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Inserted at"
|
msgid "Inserted at"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -155,7 +155,7 @@ msgid "Logout"
|
|||||||
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 "MusicBrainz ID"
|
msgid "MusicBrainz ID"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -256,7 +256,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:71
|
#: lib/music_library_web/live/record_live/show.ex:71
|
||||||
#: 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:49
|
#: lib/music_library_web/live/wishlist_live/show.ex:69
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Show"
|
msgid "Show"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -312,7 +312,7 @@ msgid "Types"
|
|||||||
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 "Updated at"
|
msgid "Updated at"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -351,13 +351,13 @@ msgid "close"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:72
|
#: lib/music_library_web/live/record_live/show.html.heex:72
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:68
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:73
|
||||||
#, 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:126
|
#: lib/music_library_web/live/record_live/show.html.heex:126
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:114
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:119
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "MusicBrainz data"
|
msgid "MusicBrainz data"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -391,22 +391,25 @@ msgid "Number of included records"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:95
|
#: lib/music_library_web/live/record_live/show.html.heex:95
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:83
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:88
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Includes"
|
msgid "Includes"
|
||||||
msgstr ""
|
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/wishlist_live/show.ex:59
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Error refreshing MusicBrainz data"
|
msgid "Error refreshing MusicBrainz data"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.ex:53
|
#: lib/music_library_web/live/record_live/show.ex:53
|
||||||
|
#: lib/music_library_web/live/wishlist_live/show.ex:51
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "MusicBrainz data refreshed successfully"
|
msgid "MusicBrainz data refreshed successfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/show.html.heex:9
|
#: lib/music_library_web/live/record_live/show.html.heex:9
|
||||||
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:9
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Refresh MB Data"
|
msgid "Refresh MB Data"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
Reference in New Issue
Block a user