Recover edit form after disconnection
This commit is contained in:
@@ -30,6 +30,7 @@ defmodule MusicLibraryWeb.FormComponent do
|
||||
id="record-form"
|
||||
phx-target={@myself}
|
||||
phx-change="validate"
|
||||
phx-auto-recover="recover_form"
|
||||
phx-submit="save"
|
||||
>
|
||||
<div class="sm:columns-2">
|
||||
@@ -146,6 +147,10 @@ defmodule MusicLibraryWeb.FormComponent do
|
||||
save_record(socket, record_params, uploaded_covers)
|
||||
end
|
||||
|
||||
def handle_event("recover_form", params, socket) do
|
||||
handle_event("validate", params, socket)
|
||||
end
|
||||
|
||||
defp save_record(socket, record_params, uploaded_covers) do
|
||||
params =
|
||||
case uploaded_covers do
|
||||
|
||||
+14
-14
@@ -23,8 +23,8 @@ msgstr ""
|
||||
msgid "Are you sure?"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:40
|
||||
#: lib/music_library_web/components/form_component.ex:47
|
||||
#: lib/music_library_web/components/form_component.ex:41
|
||||
#: lib/music_library_web/components/form_component.ex:48
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Choose a value"
|
||||
msgstr ""
|
||||
@@ -38,7 +38,7 @@ msgstr ""
|
||||
msgid "Collection"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:61
|
||||
#: lib/music_library_web/components/form_component.ex:62
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Cover art"
|
||||
msgstr ""
|
||||
@@ -74,7 +74,7 @@ msgstr ""
|
||||
msgid "Error!"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:46
|
||||
#: lib/music_library_web/components/form_component.ex:47
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Format"
|
||||
msgstr ""
|
||||
@@ -128,7 +128,7 @@ msgstr ""
|
||||
msgid "Logout"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:51
|
||||
#: lib/music_library_web/components/form_component.ex:52
|
||||
#: lib/music_library_web/live/collection_live/show.html.heex:178
|
||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:198
|
||||
#, elixir-autogen, elixir-format
|
||||
@@ -169,7 +169,7 @@ msgstr ""
|
||||
msgid "Purchase"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:57
|
||||
#: lib/music_library_web/components/form_component.ex:58
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Purchased at"
|
||||
msgstr ""
|
||||
@@ -188,22 +188,22 @@ msgstr ""
|
||||
msgid "Record imported successfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:166
|
||||
#: lib/music_library_web/components/form_component.ex:171
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Record updated successfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:52
|
||||
#: lib/music_library_web/components/form_component.ex:53
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Release"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:117
|
||||
#: lib/music_library_web/components/form_component.ex:118
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Save"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:117
|
||||
#: lib/music_library_web/components/form_component.ex:118
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Saving..."
|
||||
msgstr ""
|
||||
@@ -270,7 +270,7 @@ msgstr ""
|
||||
msgid "Total wishlist"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:39
|
||||
#: lib/music_library_web/components/form_component.ex:40
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Type"
|
||||
msgstr ""
|
||||
@@ -671,17 +671,17 @@ msgstr ""
|
||||
msgid "Similar artists"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:111
|
||||
#: lib/music_library_web/components/form_component.ex:112
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "PNG, JPG, WEBP up to 8MB"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:105
|
||||
#: lib/music_library_web/components/form_component.ex:106
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Upload a file"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/form_component.ex:108
|
||||
#: lib/music_library_web/components/form_component.ex:109
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "or drag and drop"
|
||||
msgstr ""
|
||||
|
||||
Reference in New Issue
Block a user