6afa0cdf0d
deploy / deploy (push) Successful in 3s
Day one no longer sends immediately on signup — a readiness email goes out first, and day one only sends once that's clicked. Update the post-submit status text so it matches what actually happens. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
53 lines
2.0 KiB
HTML
53 lines
2.0 KiB
HTML
{{ define "main" }}
|
|
<h1 style="font-size:2rem; margin-bottom:0.5rem;">{{ .Title }}</h1>
|
|
{{ with .Params.pitch }}<div style="font-size:1.05rem; opacity:0.9;">{{ . | markdownify }}</div>{{ end }}
|
|
{{ .Content }}
|
|
|
|
<form id="enroll-form" style="margin-top:2rem; max-width:24rem;">
|
|
<label for="email">Email</label>
|
|
<input type="email" id="email" name="email" required autocomplete="email" placeholder="you@example.com">
|
|
|
|
<div class="field-honeypot" aria-hidden="true">
|
|
<label for="website">Leave this field empty</label>
|
|
<input type="text" id="website" name="website" tabindex="-1" autocomplete="off">
|
|
</div>
|
|
|
|
<button type="submit" class="btn">Send me day one</button>
|
|
</form>
|
|
<p id="enroll-status" role="status" style="margin-top:1rem;"></p>
|
|
|
|
<script>
|
|
(function () {
|
|
var form = document.getElementById("enroll-form");
|
|
var status = document.getElementById("enroll-status");
|
|
var slug = {{ .Params.eec_slug }};
|
|
form.addEventListener("submit", function (e) {
|
|
e.preventDefault();
|
|
if (form.website.value) return; // honeypot
|
|
var submitBtn = form.querySelector("button[type=submit]");
|
|
submitBtn.disabled = true;
|
|
status.textContent = "Signing you up…";
|
|
fetch("{{ .Site.Params.eec_base_url }}/courses/" + slug + "/enroll", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ email: form.email.value })
|
|
}).then(function (res) {
|
|
if (res.ok) {
|
|
form.reset();
|
|
form.hidden = true;
|
|
status.textContent = "Check your inbox — let us know you're ready and we'll get started.";
|
|
return;
|
|
}
|
|
return res.text().then(function (msg) {
|
|
submitBtn.disabled = false;
|
|
status.textContent = msg || "Something went wrong. Try again in a moment.";
|
|
});
|
|
}).catch(function () {
|
|
submitBtn.disabled = false;
|
|
status.textContent = "Something went wrong. Try again in a moment.";
|
|
});
|
|
});
|
|
})();
|
|
</script>
|
|
{{ end }}
|