mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 22:16:07 +01:00
Allow flagging events as not attending
This commit is contained in:
parent
4f3374b336
commit
3872722acd
4 changed files with 16 additions and 22 deletions
|
@ -15,6 +15,7 @@ timings:
|
|||
duration: PT3H30M
|
||||
- starts: 2024-08-30T18:30:00+01:00
|
||||
duration: PT3H30M
|
||||
attending: false
|
||||
- starts: 2024-09-27T18:30:00+01:00
|
||||
duration: PT3H30M
|
||||
- starts: 2024-10-25T18:30:00+01:00
|
||||
|
|
|
@ -18,17 +18,7 @@ Some of my recent (and more substantial) writing.
|
|||
|
||||
## Upcoming events
|
||||
|
||||
{{ $allEvents := where .Site.RegularPages "Section" "calendar" -}}
|
||||
{{- $upcomingEvents := slice -}}
|
||||
{{- range $eventPage := $allEvents -}}
|
||||
{{- range $eventPage.Params.timings -}}
|
||||
{{- $event := dict "Title" $eventPage.Title "Page" $eventPage.Page "Date" (time.AsTime .starts) "Duration" (partial "iso8601.duration" .duration) -}}
|
||||
{{- if $event.Date.Before time.Now }}{{ continue }}{{ end -}}
|
||||
{{- $upcomingEvents = sort ($upcomingEvents | append $event) "Date" "asc" -}}
|
||||
{{- break -}}{{/* Only show the first on the list */}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $upcomingEvents := partial "upcoming-events.obj" }}
|
||||
{{- if ge (len $upcomingEvents) 2 -}}
|
||||
Maybe you'll see me at **{{ (index $upcomingEvents 0).Title }}** on {{ (partial "year-relative-date.html" (index $upcomingEvents 0).Date) | plainify }}, or **{{ (index $upcomingEvents 1).Title }}** on {{ (partial "year-relative-date.html" (index $upcomingEvents 1).Date) | plainify }}.
|
||||
Get in touch if you'd like to go to these, or any other events⁺, together!
|
||||
|
|
|
@ -27,17 +27,8 @@
|
|||
|
||||
<p class="post-content">{{ partial "svg.html" (dict "name" "document") }} Check out <a href="/posts">all my longer posts</a>, or read through my <a href="/bookmarks">thoughts on others' writing</a>.</p>
|
||||
|
||||
{{- $allEvents := where .Site.RegularPages "Section" "calendar" -}}
|
||||
{{- $upcomingEvents := slice }}
|
||||
{{- range $eventPage := $allEvents -}}
|
||||
{{ range $eventPage.Params.timings }}
|
||||
{{ $event := dict "Title" $eventPage.Title "Page" $eventPage.Page "Date" (time.AsTime .starts) "Duration" (partial "iso8601.duration" .duration) }}
|
||||
{{ if $event.Date.Before time.Now }}{{ continue }}{{ end }}
|
||||
{{ $upcomingEvents = sort ($upcomingEvents | append $event) "Date" "asc" }}
|
||||
{{ break }}{{/* Only show the first on the list */}}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- $upcomingEvents := partial "upcoming-events.obj" }}
|
||||
{{ $upcomingEvents }}
|
||||
{{ if ge (len $upcomingEvents) 2 }}
|
||||
<hr class="mini" />
|
||||
<p class="post-content">
|
||||
|
|
12
layouts/partials/upcoming-events.obj
Normal file
12
layouts/partials/upcoming-events.obj
Normal file
|
@ -0,0 +1,12 @@
|
|||
{{- $allEvents := where site.RegularPages "Section" "calendar" -}}
|
||||
{{- $upcomingEvents := slice }}
|
||||
{{- range $eventPage := $allEvents -}}
|
||||
{{ range $eventPage.Params.timings }}
|
||||
{{ $event := dict "Title" $eventPage.Title "Page" $eventPage.Page "Date" (time.AsTime .starts) "Duration" (partial "iso8601.duration" .duration) }}
|
||||
{{ if $event.Date.Before time.Now }}{{ continue }}{{ end }}
|
||||
{{ if eq .attending false }}{{ continue }}{{ end }}
|
||||
{{ $upcomingEvents = sort ($upcomingEvents | append $event) "Date" "asc" }}
|
||||
{{ break }}{{/* Only show the first on the list */}}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{- return $upcomingEvents -}}
|
Loading…
Reference in a new issue