Replaces hardcoded paths with R module throughout: - Shop components: layout nav, cart, product links - Controllers: cart, checkout, contact, seo, order lookup - Shop pages: collection, product, search, checkout success, etc. - Site context: nav item url resolution Admin URL management: - Settings page: prefix editor with validation feedback - Page renderer: url_editor component for page URLs - CSS for url editor styling Test updates for cache isolation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
30 lines
805 B
Elixir
30 lines
805 B
Elixir
defmodule BerrypodWeb.ContactController do
|
|
use BerrypodWeb, :controller
|
|
|
|
alias Berrypod.ContactNotifier
|
|
|
|
plug BerrypodWeb.Plugs.RateLimit, [type: :api] when action == :create
|
|
|
|
@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: R.contact())
|
|
|
|
{:error, :invalid_params} ->
|
|
conn
|
|
|> put_flash(:error, "Please fill in all required fields.")
|
|
|> redirect(to: R.contact())
|
|
|
|
{:error, _} ->
|
|
conn
|
|
|> put_flash(:error, "Sorry, something went wrong. Please try again.")
|
|
|> redirect(to: R.contact())
|
|
end
|
|
end
|
|
end
|