add no-JS fallback for provider forms

Progressive enhancement: provider form now works without JavaScript.
Forms POST to ProvidersController (create/update), which handles
validation and redirects with flash messages.

With JS: LiveView phx-submit handles save, navigates with flash.
Without JS: Form POSTs to controller, redirects with flash.

Completes Task 3 of notification overhaul (admin forms migration).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-03-08 07:30:16 +00:00
parent 3e29a89fff
commit 0834437340
4 changed files with 70 additions and 3 deletions

View File

@@ -27,7 +27,18 @@
</div>
<% end %>
<.form for={@form} id="provider-form" phx-change="validate" phx-submit="save">
<.form
for={@form}
id="provider-form"
action={
if @live_action == :new,
do: ~p"/admin/providers",
else: ~p"/admin/providers/#{@connection.id}"
}
method="post"
phx-change="validate"
phx-submit="save"
>
<input type="hidden" name="provider_connection[provider_type]" value={@provider_type} />
<.input