Skip to content

Commit

Permalink
Fix hard-coded year.
Browse files Browse the repository at this point in the history
Added code to determine current year and account for future events
in the following year.


Former-commit-id: 0b87d5a
  • Loading branch information
jyee committed Apr 16, 2016
1 parent 43db0ba commit b06ab36
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions themes/devopsdays-legacy/layouts/partials/future.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
<!--
Future events (i.e. "current" status) should take place in the current or
following year. E.g. We should have events in January next year appear when it
is December of the current year.
This code creates 2-3 lists: One of current years and a list of current events
for each year (namespaced with "future" to prevent collisions). Later we loop
through these lists to generate our event info.
-->

{{ 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 }}

<div class="span-6 last">
<div style=" padding-top:18px;" class="span-5 last">
<h1>Future</h1>
Expand All @@ -9,14 +29,13 @@ <h1>Future</h1>
<tr>
<div style="display:table-cell; vertical-align:top">
<div style="margin:1px;">
<strong>2016</strong> <!--lazy hardcoding! -->
<br/>
{{ range ($.Scratch.GetSortedMapValues "future_years") }}
<strong>{{ . }}</strong><br/>

{{ range $.Site.Data.events }}
{{ if eq .status "current" }}
<a href="/events/{{ .friendly}}">{{ .city }}: {{ dateFormat "Jan 2" .startdate }} - {{ dateFormat "Jan 2" .enddate }}</a>
<br />
{{ end }}
{{ range ($.Scratch.GetSortedMapValues (print "future" .)) }}
{{ $c_event := (index $.Site.Data.events .) }}
<a href="/events/{{ $c_event.friendly }}">{{ $c_event.city }}: {{ dateFormat "Jan 2" $c_event.startdate }} - {{ dateFormat "Jan 2" $c_event.enddate }}</a><br />
{{ end }}
{{ end }}
</div>
</div>
Expand Down

0 comments on commit b06ab36

Please sign in to comment.