add no-JS contact form and noscript banner
All checks were successful
deploy / deploy (push) Successful in 1m21s

Wire up the contact form with action/method/name attrs so it works
without JavaScript. Add ContactNotifier, ContactController, and a
noscript info banner in the shop root layout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-28 18:57:51 +00:00
parent af069c2bca
commit ca01f43d70
8 changed files with 256 additions and 8 deletions

View File

@@ -0,0 +1,27 @@
defmodule BerrypodWeb.ContactController do
use BerrypodWeb, :controller
alias Berrypod.ContactNotifier
@doc """
Handles contact form submission (no-JS fallback).
"""
def create(conn, params) do
case ContactNotifier.deliver_contact_message(params) do
{:ok, _} ->
conn
|> put_flash(:info, "Message sent! We'll get back to you soon.")
|> redirect(to: ~p"/contact")
{:error, :invalid_params} ->
conn
|> put_flash(:error, "Please fill in all required fields.")
|> redirect(to: ~p"/contact")
{:error, _} ->
conn
|> put_flash(:error, "Sorry, something went wrong. Please try again.")
|> redirect(to: ~p"/contact")
end
end
end