mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
add mailing list signup with email confirmation (#67)
This commit is contained in:
@@ -8,6 +8,8 @@ defmodule ChesstrainerWeb.LandingComponents do
|
||||
"""
|
||||
use Phoenix.Component
|
||||
|
||||
import Phoenix.Controller, only: [get_csrf_token: 0]
|
||||
|
||||
alias Chesstrainer.FEN
|
||||
alias Chesstrainer.Themes
|
||||
|
||||
@@ -70,6 +72,43 @@ defmodule ChesstrainerWeb.LandingComponents do
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Renders the mailing-list signup band.
|
||||
|
||||
The form posts to `POST /mailing-list` and the controller redirects back to
|
||||
the `#mailing-list` anchor with a flash. Keeping it a plain form means the
|
||||
landing page needs no LiveView to collect an address.
|
||||
"""
|
||||
def mailing_list_signup(assigns) do
|
||||
~H"""
|
||||
<section class="mailing-list" id="mailing-list">
|
||||
<div class="mailing-list-copy">
|
||||
<span class="section-kicker">Mailing list</span>
|
||||
<h2>One good endgame idea, now and then.</h2>
|
||||
<p>
|
||||
Occasional emails about new puzzles and features. We'll ask you to confirm your address first.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form action="/mailing-list" method="post" id="mailing-list-form" class="mailing-list-form">
|
||||
<input type="hidden" name="_csrf_token" value={get_csrf_token()} />
|
||||
<label for="mailing-list-email">Email address</label>
|
||||
<div class="mailing-list-row">
|
||||
<input
|
||||
id="mailing-list-email"
|
||||
type="email"
|
||||
name="subscriber[email]"
|
||||
placeholder="you@example.com"
|
||||
autocomplete="email"
|
||||
required
|
||||
/>
|
||||
<.pill_button variant={:primary} type="submit">Join the list</.pill_button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
"""
|
||||
end
|
||||
|
||||
@doc """
|
||||
Renders a static board preview for the landing page.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user