From 55131e8356a25551a410cd945d951aa44ec88f0d Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Sun, 2 Jun 2024 08:48:59 +0800 Subject: [PATCH] Add fallback email to guestbook --- src/assets/css/comments.css | 4 ++++ src/assets/js/comments.js | 17 +++++++++++++++++ src/pages/guestbook.njk | 1 + 3 files changed, 22 insertions(+) diff --git a/src/assets/css/comments.css b/src/assets/css/comments.css index d3be79ff..e5188c7b 100644 --- a/src/assets/css/comments.css +++ b/src/assets/css/comments.css @@ -55,6 +55,10 @@ background-color: var(--clr-quote-bg); } +.inline-banner.warning { + background-color: #9e0f00; +} + .form-footer, .comment-footer { display: flex; diff --git a/src/assets/js/comments.js b/src/assets/js/comments.js index e4d418b0..454107c7 100644 --- a/src/assets/js/comments.js +++ b/src/assets/js/comments.js @@ -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 = + ` + + + That didn't work. + ${this.fallbackEmail + ? `Click here to send as an email instead.` + : "" + } + + `; + } + else + { + alert("Your comment has been submitted!"); } }; diff --git a/src/pages/guestbook.njk b/src/pages/guestbook.njk index 577ac1c0..e493003d 100644 --- a/src/pages/guestbook.njk +++ b/src/pages/guestbook.njk @@ -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 }}" >

Guest Messages