From 421ee9b6821e710ee04da8c2020e13817e5b8397 Mon Sep 17 00:00:00 2001 From: Andrew Kreps Date: Thu, 23 Apr 2026 09:23:48 -0700 Subject: [PATCH 1/4] Altered field for email publishing and added client-side requirement --- site/themes/s2b_hugo_theme/assets/js/cal/addevent.js | 8 ++++++++ .../s2b_hugo_theme/layouts/partials/cal/edit.html | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js b/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js index 6223b082..0550861b 100644 --- a/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js +++ b/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js @@ -183,6 +183,14 @@ $('.help-block').remove(); $('.save-result').removeClass('text-danger').text(''); postVars = eventFromForm(); + if (!postVars.hideemail) { + var input = $('[name=hideemail]'), + parent = input.closest('.form-group'); + input.attr('aria-invalid', true); + parent.addClass('has-error') + .append('
Please select whether to publish your email address.
'); + return; + } if (!isNew) { postVars['id'] = shiftEvent.id; } diff --git a/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html b/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html index 9fb6e7b6..537e5a45 100644 --- a/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html +++ b/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html @@ -336,11 +336,13 @@

This must be a valid email address where we can reach you. A confirmation message will be mailed to this address.

-
- +
+ +
From 2b02d5ddd47344efa2aee52195d43e6cce126bab Mon Sep 17 00:00:00 2001 From: Andrew Kreps Date: Thu, 30 Apr 2026 18:48:53 -0700 Subject: [PATCH 2/4] Fixes #1048 Adding full-size dropdown for show email for you consideration. --- site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html b/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html index 537e5a45..07ecc0b4 100644 --- a/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html +++ b/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html @@ -339,9 +339,9 @@

From 7098cce54651d1310b63007122a0470a2f509ba8 Mon Sep 17 00:00:00 2001 From: Andrew Kreps Date: Thu, 30 Apr 2026 18:59:30 -0700 Subject: [PATCH 3/4] Added input focus on fail to select --- site/themes/s2b_hugo_theme/assets/js/cal/addevent.js | 1 + 1 file changed, 1 insertion(+) diff --git a/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js b/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js index 0550861b..0a10cdd9 100644 --- a/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js +++ b/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js @@ -189,6 +189,7 @@ input.attr('aria-invalid', true); parent.addClass('has-error') .append('
Please select whether to publish your email address.
'); + input.focus(); return; } if (!isNew) { From 8f95fad2e48b24b2dda821cc9f04161bbcf207a9 Mon Sep 17 00:00:00 2001 From: Andrew Kreps Date: Thu, 30 Apr 2026 20:14:51 -0700 Subject: [PATCH 4/4] Added the validation to the backend. --- app/models/calEventValidator.js | 13 ++++++++++++- .../s2b_hugo_theme/assets/js/cal/addevent.js | 9 --------- .../layouts/partials/cal/edit.html | 18 ++++++++++-------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/models/calEventValidator.js b/app/models/calEventValidator.js index b14816dc..57cac8a3 100644 --- a/app/models/calEventValidator.js +++ b/app/models/calEventValidator.js @@ -119,6 +119,17 @@ function makeValidator(input, errors) { return validator.toBoolean(str) ? 1 : 0; } }, + // requires a 0, 1, true, or false value; empty is an error + requiredFlag(field, msg) { + const str = getString(field); + if (validator.isEmpty(str)) { + errors.addError(field, msg); + } else if (!validator.isBoolean(str)) { + errors.addError(field); + } else { + return validator.toBoolean(str) ? 1 : 0; + } + }, // if not specified, returns 0 // otherwise expects an int-like value // greater than or equal to 0 @@ -215,7 +226,7 @@ function validateEvent(input) { address: v.requireString('address', 'Address missing'), name: v.requireString('organizer', 'Organizer missing'), email: v.requireEmail('email'), - hideemail: v.optionalFlag('hideemail'), + hideemail: v.requiredFlag('hideemail', 'Please select whether or not to publish your email address'), phone: v.nullString('phone'), hidephone: v.optionalFlag('hidephone'), contact: v.nullString('contact'), diff --git a/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js b/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js index 0a10cdd9..6223b082 100644 --- a/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js +++ b/site/themes/s2b_hugo_theme/assets/js/cal/addevent.js @@ -183,15 +183,6 @@ $('.help-block').remove(); $('.save-result').removeClass('text-danger').text(''); postVars = eventFromForm(); - if (!postVars.hideemail) { - var input = $('[name=hideemail]'), - parent = input.closest('.form-group'); - input.attr('aria-invalid', true); - parent.addClass('has-error') - .append('
Please select whether to publish your email address.
'); - input.focus(); - return; - } if (!isNew) { postVars['id'] = shiftEvent.id; } diff --git a/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html b/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html index 07ecc0b4..ee3b5938 100644 --- a/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html +++ b/site/themes/s2b_hugo_theme/layouts/partials/cal/edit.html @@ -335,15 +335,17 @@

This must be a valid email address where we can reach you. A confirmation message will be mailed to this address.

+ -
- - -
+
+ + +

This option chooses whether or not to publish your email address on the calendar.

+
Website for additional details