From ae3299a54897076c27c010d64a28e1e8455827a9 Mon Sep 17 00:00:00 2001 From: carrythebanner Date: Thu, 5 Mar 2026 18:26:16 -0800 Subject: [PATCH 1/3] add ICS export URL to event object --- app/models/calDaily.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/models/calDaily.js b/app/models/calDaily.js index 5e955e7c..476ff2f1 100644 --- a/app/models/calDaily.js +++ b/app/models/calDaily.js @@ -81,6 +81,12 @@ const methods = { return config.site.url("calendar", `event-${this.pkid}`); }, + // return a url which exports this particular occurrence to calendar apps + // ex. https://localhost:4443/api/ics.php?event_id=13662 + getExportable() { + return config.site.url("api", `ics.php?event_id=${this.pkid}`); + }, + // return true if the occurrence has been removed from the calendar; false otherwise. // ( differentiates between explicitly canceled, and no longer scheduled. ) isDelisted() { @@ -106,6 +112,7 @@ const methods = { date: this.getFormattedDate(), caldaily_id: this.pkid.toString(), shareable: this.getShareable(), + exportable: this.getExportable(), cancelled: this.isUnscheduled(), // better would have been "scheduled:true" // don't send newsflash when delisted: // it's not scheduled and may be deleted From 04cef83d3fa39b02e5e3dc25c3c7bbb8a6374ee3 Mon Sep 17 00:00:00 2001 From: carrythebanner Date: Thu, 5 Mar 2026 18:41:11 -0800 Subject: [PATCH 2/3] documentation for new property --- docs/CALENDAR_API.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CALENDAR_API.md b/docs/CALENDAR_API.md index 2ad37179..39e89330 100644 --- a/docs/CALENDAR_API.md +++ b/docs/CALENDAR_API.md @@ -83,6 +83,7 @@ Example response for a single event: "date": "2017-06-05", "caldaily_id": "9300", "shareable": "https://shift2bikes.org/calendar/event-9300", + "exportable": "https://shift2bikes.org/api/ics.php?event_id=9300", "cancelled": false, "newsflash": null, "status": "A", From b86cc750aca149ef0a40d1e8e2e3bd1ef028290e Mon Sep 17 00:00:00 2001 From: carrythebanner Date: Thu, 5 Mar 2026 18:49:49 -0800 Subject: [PATCH 3/3] use exportable URL from API, no need to reconstruct it now --- site/themes/s2b_hugo_theme/assets/js/cal/main.js | 4 ---- site/themes/s2b_hugo_theme/layouts/partials/cal/events.html | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/site/themes/s2b_hugo_theme/assets/js/cal/main.js b/site/themes/s2b_hugo_theme/assets/js/cal/main.js index d039ead1..882f61da 100755 --- a/site/themes/s2b_hugo_theme/assets/js/cal/main.js +++ b/site/themes/s2b_hugo_theme/assets/js/cal/main.js @@ -52,10 +52,6 @@ $(document).ready(function() { value.webLink = container.getWebLink(value.weburl); value.contactLink = container.getContactLink(value.contact); - let exportURL = new URL(API_ICS_URL); - exportURL.searchParams.set('event_id', value.caldaily_id); - value.exportlink = exportURL.toString(); - value.addToGoogleLink = container.getAddToGoogleLink(value); groupedByDate[date].events.push(value); diff --git a/site/themes/s2b_hugo_theme/layouts/partials/cal/events.html b/site/themes/s2b_hugo_theme/layouts/partials/cal/events.html index d9eed8fa..1cc6c012 100644 --- a/site/themes/s2b_hugo_theme/layouts/partials/cal/events.html +++ b/site/themes/s2b_hugo_theme/layouts/partials/cal/events.html @@ -287,7 +287,7 @@