diff --git a/lib/music_library_web/live/artist_live/show.ex b/lib/music_library_web/live/artist_live/show.ex index 33b35bf2..253b84f9 100644 --- a/lib/music_library_web/live/artist_live/show.ex +++ b/lib/music_library_web/live/artist_live/show.ex @@ -185,6 +185,16 @@ defmodule MusicLibraryWeb.ArtistLive.Show do end end + def handle_event("delete", %{"id" => id}, socket) do + record = Records.get_record!(id) + {:ok, _} = Records.delete_record(record) + + {:noreply, + socket + |> assign_records(socket.assigns.artist.musicbrainz_id) + |> put_flash(:info, gettext("Record deleted"))} + end + defp apply_action(socket, :show, %{"musicbrainz_id" => musicbrainz_id}) do artist = Artists.get_artist!(musicbrainz_id) artist_info = Artists.get_artist_info!(musicbrainz_id) diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 08588846..e3a9adb3 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -880,3 +880,8 @@ msgstr "" #, elixir-autogen, elixir-format msgid "In progress - record will update automatically" msgstr "" + +#: lib/music_library_web/live/artist_live/show.ex +#, elixir-autogen, elixir-format +msgid "Record deleted" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index b2369ed7..7813cd49 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -880,3 +880,8 @@ msgstr "" #, elixir-autogen, elixir-format msgid "In progress - record will update automatically" msgstr "" + +#: lib/music_library_web/live/artist_live/show.ex +#, elixir-autogen, elixir-format +msgid "Record deleted" +msgstr ""