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 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", 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 @@