Skip to content

Commit

Permalink
Refactor future footer
Browse files Browse the repository at this point in the history
It's somewhat sloppy, and has the year 2016 hardcoded into it for now, but it works. This removes the issue with the "events on the same date" (only for future footer; the issue still exists for past events for now) and it also takes care of the "year in quotes" issue.

Resolves #247
Resolves #246
Resolves #233
  • Loading branch information
mattstratton committed May 6, 2016
1 parent a2af118 commit ac1f054
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 28 deletions.
4 changes: 1 addition & 3 deletions data/events/2016-ohio.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "2016-ohio" # The name of the event. Four digit year with the city name in lower-case, with no spaces.
year: "2016" # The year of the event. Make sure it is in quotes.
year: 2016 # The year of the event. Make sure it is in quotes.
city: "Ohio" # The city name of the event. Capitalize it.
friendly: "2016-ohio" # Four digit year and the city name in lower-case. Don't forget the dash!
status: "current" # Options are "past" or "current".
Expand Down Expand Up @@ -34,5 +34,3 @@ sponsor_levels: # In this section, list the level of sponsorships and the label
label: Bronze
- id: media
label: Media


46 changes: 21 additions & 25 deletions themes/devopsdays-legacy/layouts/partials/future.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,10 @@
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.
^^^ This isn't how this works right now - this is a sloppy implementation which hard-codes it to the year 2016, but it works for now -@mattstratton
-->

{{ 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 }}
{{ if .startdate }}
{{ $.Scratch.SetInMap (print "future" $future_year) .startdate .friendly }}
{{ else }}
{{ $.Scratch.SetInMap (print "future" $future_year) "TBD" .friendly }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}

<div class="span-6 last">
<div style=" padding-top:18px;" class="span-5 last">
Expand All @@ -33,18 +22,25 @@ <h1>Future</h1>
<tr>
<div style="display:table-cell; vertical-align:top">
<div style="margin:1px;">
{{ range ($.Scratch.GetSortedMapValues "future_years") }}
<strong>{{ . }}</strong><br/>
{{ range ($.Scratch.GetSortedMapValues (print "future" .)) }}
{{ $c_event := (index $.Site.Data.events .) }}
<a href="/events/{{ $c_event.name }}">{{ $c_event.city }}:
{{ if $c_event.startdate }}
{{ dateFormat "Jan 2" $c_event.startdate }} - {{ dateFormat "Jan 2" $c_event.enddate }}
{{ else }}
Coming Soon!
{{ end }}
</a><br />
{{ end }}
<strong>2016</strong><br/>
{{ range sort $.Site.Data.events "startdate" }}
{{ if and ( eq .status "current") ( .startdate ) }}
<a href = "/events/{{ .name }}/welcome">
{{ .city }}
{{ dateFormat "Jan 2" .startdate }}
-
{{ dateFormat "Jan 2" .enddate }}
</a><br />
{{ end }}
{{ end }}
<br />
<strong>2016, Dates TBD</strong><br/>
{{ range sort $.Site.Data.events "startdate" }}
{{ if and ( eq .status "current") ( not .startdate ) }}
<a href = "/events/{{ .name }}/welcome">
{{ .city }}
</a><br />
{{ end }}
{{ end }}
</div>
</div>
Expand Down

0 comments on commit ac1f054

Please sign in to comment.