Skip to content

Conversation

@ionous
Copy link
Contributor

@ionous ionous commented Aug 13, 2024

fixes #116 by exposing a new endpoint which covers "all events" ( 1 month in the past and 6 months in the future at ): /cal/shift-calendar.php ( which maps into node at /api/shift-calendar.php with no query parameters ) and adds a banner to the /calendar page describing the new feed ( see below ); and updates the FAQ to describe both calendars.

note: this changes the existing ical header for the pedalp endpoint by giving it a new friendly name and description, while keeping its global unique id set to shift@shift2bikes.org
was:

X-WR-CALNAME:Shift Bike Calendar
X-WR-CALDESC:Find fun bike events and make new friends!
X-WR-RELCALID:shift@shift2bikes.org

now:

X-WR-CALNAME:Pedalpalooza Bike Calendar
X-WR-CALDESC:Find fun Pedalpalooza bike events!
X-WR-RELCALID:shift@shift2bikes.org

it uses the following ical header for the all events feed, and for any individually downloaded events:

X-WR-CALNAME:Shift Community Calendar
X-WR-CALDESC:Find fun bike events all year round.
X-WR-RELCALID:community@shift2bikes.org

image

ionous added 2 commits August 12, 2024 19:28
fixes shift-org#116
tweaks the existing ical header for the pedalp endpoint by giving it a new friendly name and description, while keeping its global unique id as `shift@shift2bikes.org`

```
X-WR-CALNAME:Pedalpalooza Bike Calendar
X-WR-CALDESC:Find fun Pedalpalooza bike events!
X-WR-RELCALID:shift@shift2bikes.org
```

adds a new header use for all other ical feeds ( including single event download )
```
X-WR-CALNAME:Shift Community Calendar
X-WR-CALDESC:Find fun bike events all year round.
X-WR-RELCALID:community@shift2bikes.org
```

exposes an end point which covers "all events" ( 1 month in the past and 6 months in the future at ):
`/cal/shift-calendar.php' ( which maps to node at `/api/shift-calendar.php` )
- when returning the pedalpalooza feed, adds a special all day end of festival event on the day *after* pedalpalooza

- changes the start and end date objects into dayjs to simplify the end event ( was raw query strings, which seems bad practice anyway )

- moves "escapeBreak" and ical date formatting to a nunjucks filter to make that code easier to reuse ( for the end event )

- changes a (start || end) to (start && end) in getEventData to avoid an exception if one is null/false; we don't have to be so clever about validating the parameters; it's only the webclient anyway.
Copy link
Collaborator

@carrythebanner carrythebanner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Could also add the cal feed banner to the /calgrid page, and could probably hide it on individual ride listings, but (once the minor merge conflicts are resolved) I'm good to merge this either way.

With 2 promo banners stacked there's a bit much in terms of top matter, but we'll be hiding the PP promo banner in 2 days so that's a non-issue IMO.

@ionous ionous marked this pull request as ready for review August 30, 2024 19:16
@ionous ionous merged commit b30c5a8 into shift-org:main Aug 30, 2024
@ionous ionous deleted the all-events branch August 30, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calendar: create iCalendar feed for "all future event data"

2 participants