From 0e04c0a2353d46d523516f33f4fe8f30a12c97cf Mon Sep 17 00:00:00 2001 From: collin Date: Wed, 27 Aug 2025 17:46:36 +0200 Subject: [PATCH] Changing how the RSVP button is displayed and how setting the cookie works --- client/index.html | 17 +++++++---------- client/index.js | 10 ---------- client/rsvp_confirmed.html | 1 + client/rsvp_confirmed.js | 11 +++++++++++ client/style.css | 15 +++++++-------- controller.go | 3 +++ 6 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 client/rsvp_confirmed.js diff --git a/client/index.html b/client/index.html index c31b660..b4a788e 100644 --- a/client/index.html +++ b/client/index.html @@ -6,6 +6,13 @@

Collin and Lucy's Wedding

+

When?

Saturday 16th of May 2026

@@ -35,16 +42,6 @@
Open Map
- - - \ No newline at end of file diff --git a/client/index.js b/client/index.js index 84b7113..7d4307a 100644 --- a/client/index.js +++ b/client/index.js @@ -8,20 +8,10 @@ function hasRsvped() { return cookies[COOKIE_NAME] === "true"; } -function persistRsvp(hasRsvped = true) { - document.cookie = `${COOKIE_NAME}=${String(hasRsvped)}; path=/`; - console.log(document.cookie); -} - -function rsvpButtonClicked() { - persistRsvp(true); -} window.onload = function () { if (!hasRsvped()) { const rsvpButton = document.querySelector(".rsvpButton"); rsvpButton.classList.remove("hidden"); - - rsvpButton.onclick = rsvpButtonClicked; } }; diff --git a/client/rsvp_confirmed.html b/client/rsvp_confirmed.html index 2532c17..7604f36 100644 --- a/client/rsvp_confirmed.html +++ b/client/rsvp_confirmed.html @@ -10,5 +10,6 @@
Back + \ No newline at end of file diff --git a/client/rsvp_confirmed.js b/client/rsvp_confirmed.js new file mode 100644 index 0000000..84382c7 --- /dev/null +++ b/client/rsvp_confirmed.js @@ -0,0 +1,11 @@ +const COOKIE_NAME = "hasRsvped"; + +function persistRsvp(hasRsvped = true) { + document.cookie = `${COOKIE_NAME}=${String(hasRsvped)}; path=/`; +} + +function rsvpConfirmed() { + persistRsvp(true); +} + +rsvpConfirmed(); \ No newline at end of file diff --git a/client/style.css b/client/style.css index 102e4c9..3276b5d 100644 --- a/client/style.css +++ b/client/style.css @@ -138,7 +138,7 @@ button { /* #region contents */ .contents { height: auto; - padding: 50px; + padding: 32px; } @media (max-width: 539px) { @@ -188,14 +188,13 @@ button { /* #region rsvp */ .rsvpButton { - position: fixed; - height: 100px; - width: 18px; - top: 25px; - right: 0px; + display:inline-block; + width: 80%; + margin-left: 10%; + margin-right: 10%; + text-decoration: none; padding: 16px; - border-radius: 16px 0px 0px 16px; - mix-blend-mode: color-dodge; + border-radius: 16px 16px; cursor: pointer; } diff --git a/controller.go b/controller.go index 92162eb..091c15d 100644 --- a/controller.go +++ b/controller.go @@ -176,6 +176,9 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { case r.Method == "GET" && r.URL.Path == "/rsvp.js": getStaticFile("./client/rsvp.js", "text/javascript", w) + case r.Method == "GET" && r.URL.Path == "/rsvp_confirmed.js": + getStaticFile("./client/rsvp_confirmed.js", "text/javascript", w) + case r.Method == "GET" && r.URL.Path == "/rsvps_list.js": getStaticFile("./client/rsvps_list.js", "text/javascript", w)