rework email settings for true progressive enhancement
All checks were successful
deploy / deploy (push) Successful in 1m19s
All checks were successful
deploy / deploy (push) Successful in 1m19s
Render all adapter field sections in the form with CSS :has(:checked) controlling visibility. Selecting a provider instantly shows its config fields — no JS, no page reload, no server round-trip needed. - Render all 6 adapter configs with data-adapter attribute - CSS :has(:checked) show/hide rules per adapter in admin stylesheet - Namespace field names per adapter (email[brevo][api_key] etc) - Drop 4 transactional-only providers (Resend, Postmark, Mailgun, MailPace) - Remove noscript "Switch provider" button and controller redirect workaround - Remove configured_adapter hidden input tracking - Hide JS-only test email button for no-JS users via noscript style - LiveView progressively enhances with async save and test email Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,8 +24,7 @@ defmodule BerrypodWeb.EmailSettingsControllerTest do
|
||||
post(conn, ~p"/admin/settings/email", %{
|
||||
email: %{
|
||||
adapter: "brevo",
|
||||
configured_adapter: "brevo",
|
||||
api_key: "xkeysib-abc123def456"
|
||||
brevo: %{api_key: "xkeysib-abc123def456"}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -34,19 +33,10 @@ defmodule BerrypodWeb.EmailSettingsControllerTest do
|
||||
assert Settings.get_setting("email_adapter") == "brevo"
|
||||
end
|
||||
|
||||
test "redirects with adapter param when adapter changed", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, ~p"/admin/settings/email", %{
|
||||
email: %{adapter: "resend", configured_adapter: "brevo", api_key: ""}
|
||||
})
|
||||
|
||||
assert redirected_to(conn) == ~p"/admin/settings/email?adapter=resend"
|
||||
end
|
||||
|
||||
test "redirects with error on validation failure", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, ~p"/admin/settings/email", %{
|
||||
email: %{adapter: "brevo", configured_adapter: "brevo", api_key: ""}
|
||||
email: %{adapter: "brevo", brevo: %{api_key: ""}}
|
||||
})
|
||||
|
||||
assert redirected_to(conn) =~ ~p"/admin/settings/email"
|
||||
@@ -56,8 +46,8 @@ defmodule BerrypodWeb.EmailSettingsControllerTest do
|
||||
|
||||
describe "POST /admin/settings/email/test" do
|
||||
test "sends test email and redirects", %{conn: conn} do
|
||||
Settings.put_setting("email_adapter", "postmark")
|
||||
Settings.put_secret("email_postmark_api_key", "pm_test_abc")
|
||||
Settings.put_setting("email_adapter", "brevo")
|
||||
Settings.put_secret("email_brevo_api_key", "xkeysib-test-abc")
|
||||
|
||||
conn = post(conn, ~p"/admin/settings/email/test")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user