Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/models/calDaily.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/CALENDAR_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 0 additions & 4 deletions site/themes/s2b_hugo_theme/assets/js/cal/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ <h3>
<li>
<a
[[^preview]]
href="[[exportlink]]"
href="[[exportable]]"
[[/preview]]
data-id="[[caldaily_id]]"
class="export-link">
Expand Down