Add fallback email to guestbook

This commit is contained in:
Helen Chong 2024-06-02 08:48:59 +08:00
parent 51063b95d9
commit 55131e8356
3 changed files with 22 additions and 0 deletions

View File

@ -55,6 +55,10 @@
background-color: var(--clr-quote-bg);
}
.inline-banner.warning {
background-color: #9e0f00;
}
.form-footer,
.comment-footer {
display: flex;

View File

@ -192,6 +192,23 @@ registerNamespace("GW.Controls", function (ns)
if (request.readyState == 4)
{
console.log(request.responseText);
this.bannerEl.classList.add("warning");
this.bannerEl.innerHTML =
`
<gw-icon iconKey="triangle-exclamation"></gw-icon>
<span>
That didn't work.
${this.fallbackEmail
? `<a class="full" href="mailto:${this.fallbackEmail}?subject=Comment on ${document.title}&body=${contentAry.join("; ")}">Click here to send as an email instead</a>.`
: ""
}
</span>
`;
}
else
{
alert("Your comment has been submitted!");
}
};

View File

@ -20,6 +20,7 @@ eleventyComputed:
id="guestbookForm"
titleText="Sign the Guestbook"
discordURL="https://discord.com/api/webhooks/1243241310664659076/JQNvj369B_d8DipyooUrYA7gSfd01lBcUb7-U45OVLXkHoEkMFdjrY555B-WZYG9CwL0"
fallbackEmail="{{ sitemeta.siteAuthor.email }}"
></gw-comment-form>
<h2 class="gb__messages--title">Guest Messages</h2>