Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hard-coded year. #151

Merged
merged 1 commit into from
Apr 17, 2016
Merged
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
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