Files
twosquirrelspress-site/layouts/submissions/list.html
T
will 9dd53fdb96
deploy / deploy (push) Successful in 4s
Collect first/last name on the mailing-list subscribe form
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 19:47:32 -04:00

129 lines
5.0 KiB
HTML

{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ if ne .Params.accepting_submissions false }}
<form id="submissions-form" style="margin-top:2rem;">
<label for="name">Name</label>
<input type="text" id="name" name="name" required autocomplete="name">
<label for="email">Email</label>
<input type="email" id="email" name="email" required autocomplete="email">
<label for="project">Which title or call is this for?</label>
<input type="text" id="project" name="project" required>
<label for="description">Brief description of the submission</label>
<textarea id="description" name="description" rows="4" required></textarea>
<label for="bio">Author bio</label>
<textarea id="bio" name="bio" rows="4" required></textarea>
<label for="manuscript">Manuscript</label>
<input type="file" id="manuscript" name="manuscript" accept=".md,.markdown,.txt,.docx,.doc,.odt,.rtf,.pdf" required>
<p style="opacity:0.7; font-size:0.85rem; margin-top:-1rem;">Markdown preferred. Under ~15MB.</p>
<label for="headshot">Headshot (optional)</label>
<input type="file" id="headshot" name="headshot" accept="image/*">
<p style="opacity:0.7; font-size:0.85rem; margin-top:-1rem;">Under ~5MB.</p>
<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 submission</button>
</form>
<p id="submissions-status" role="status" style="margin-top:1rem;"></p>
<script>
(function () {
var form = document.getElementById("submissions-form");
var status = document.getElementById("submissions-status");
form.addEventListener("submit", function (e) {
e.preventDefault();
var formData = new FormData(form);
var submitBtn = form.querySelector("button[type=submit]");
submitBtn.disabled = true;
status.textContent = "Sending…";
fetch("{{ .Site.Params.eec_base_url }}/submissions", {
method: "POST",
body: formData
}).then(function (res) {
submitBtn.disabled = false;
if (res.ok) {
form.reset();
status.textContent = "Thanks — we'll be in touch.";
return;
}
return res.text().then(function (msg) {
status.textContent = msg || "Something went wrong sending that. Try again, or email submissions@twosquirrelspress.com directly.";
});
}).catch(function () {
submitBtn.disabled = false;
status.textContent = "Something went wrong sending that. Try again, or email submissions@twosquirrelspress.com directly.";
});
});
})();
</script>
{{ else }}
<p style="margin-top:2rem;">We're not currently accepting submissions, but you can join our mailing list to hear when that changes.</p>
<form id="subscribe-form" style="margin-top:1.5rem;">
<label for="subscribe-first-name">First name</label>
<input type="text" id="subscribe-first-name" name="first_name" required autocomplete="given-name">
<label for="subscribe-last-name">Last name (optional)</label>
<input type="text" id="subscribe-last-name" name="last_name" autocomplete="family-name">
<label for="email">Email</label>
<input type="email" id="email" name="email" required autocomplete="email">
<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">Join the mailing list</button>
</form>
<p id="subscribe-status" role="status" style="margin-top:1rem;"></p>
<script>
(function () {
var form = document.getElementById("subscribe-form");
var status = document.getElementById("subscribe-status");
form.addEventListener("submit", function (e) {
e.preventDefault();
var payload = {
email: form.email.value,
first_name: form.first_name.value,
last_name: form.last_name.value,
website: form.website.value
};
var submitBtn = form.querySelector("button[type=submit]");
submitBtn.disabled = true;
status.textContent = "Signing you up…";
fetch("{{ .Site.Params.eec_base_url }}/subscribe", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload)
}).then(function (res) {
submitBtn.disabled = false;
if (res.ok) {
form.reset();
status.textContent = "Thanks — we'll let you know.";
return;
}
return res.text().then(function (msg) {
status.textContent = msg || "Something went wrong signing you up. Try again, or email hello@twosquirrelspress.com directly.";
});
}).catch(function () {
submitBtn.disabled = false;
status.textContent = "Something went wrong signing you up. Try again, or email hello@twosquirrelspress.com directly.";
});
});
})();
</script>
{{ end }}
{{ end }}