From 1def302834b102676905ec5c3cbdc13adde48353 Mon Sep 17 00:00:00 2001 From: Jason Yee Date: Fri, 15 Apr 2016 23:00:43 -0700 Subject: [PATCH] Fix hard-coded year. Added code to determine current year and account for future events in the following year. Former-commit-id: 0b87d5ad7e5d3a4b3794b50a6307816639d30599 --- .../layouts/partials/future.html | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/themes/devopsdays-legacy/layouts/partials/future.html b/themes/devopsdays-legacy/layouts/partials/future.html index a1b57c49aca..641ab5e6292 100644 --- a/themes/devopsdays-legacy/layouts/partials/future.html +++ b/themes/devopsdays-legacy/layouts/partials/future.html @@ -1,3 +1,23 @@ + + +{{ range seq .Now.Year (add .Now.Year 1) }} + {{ $future_year := (chomp .) }} + {{ range $.Site.Data.events }} + {{ if and (eq .year $future_year) (eq .status "current") }} + {{ $.Scratch.SetInMap "future_years" $future_year $future_year }} + {{ $.Scratch.SetInMap (print "future" $future_year) .startdate .friendly }} + {{ end }} + {{ end }} +{{ end }} +

Future

@@ -9,14 +29,13 @@

Future

- 2016 -
+ {{ range ($.Scratch.GetSortedMapValues "future_years") }} + {{ . }}
- {{ range $.Site.Data.events }} - {{ if eq .status "current" }} - {{ .city }}: {{ dateFormat "Jan 2" .startdate }} - {{ dateFormat "Jan 2" .enddate }} -
- {{ end }} + {{ range ($.Scratch.GetSortedMapValues (print "future" .)) }} + {{ $c_event := (index $.Site.Data.events .) }} + {{ $c_event.city }}: {{ dateFormat "Jan 2" $c_event.startdate }} - {{ dateFormat "Jan 2" $c_event.enddate }}
+ {{ end }} {{ end }}