|
3 | 3 | <div> |
4 | 4 | {{ .Content }} |
5 | 5 | </div> |
6 | | -<div class = "row"> |
7 | | - <div class = "col-md-12"> |
| 6 | +<div class="row"> |
| 7 | + <div class="col-md-12"> |
8 | 8 | <h2>Upcoming</h2> |
9 | 9 | </div> |
10 | 10 | </div> |
11 | 11 |
|
12 | | -{{- $upcoming := slice -}} |
13 | | -{{- $tbd := slice -}} |
14 | | -{{- $upcoming = partial "functions/get-upcoming-events" . -}} |
15 | | -{{- $tbd = partial "functions/get-tbd-events" . -}} |
16 | | -{{- $events := slice -}} |
17 | | -{{- $events = partial "functions/get-all-events" . -}} |
| 12 | +{{- $upcoming := partial "functions/get-upcoming-events" . -}} |
| 13 | +{{- $tbd := partial "functions/get-tbd-events" . -}} |
| 14 | +{{- $events := partial "functions/get-all-events" . -}} |
18 | 15 |
|
19 | | -<div class = "row"> |
20 | | -{{- $.Scratch.Set "close-tag" "false" -}} |
| 16 | +<div class="row"> |
| 17 | +{{- $currentMonth := "" -}} |
| 18 | +{{- $needsCloseTag := false -}} |
21 | 19 | {{- range sort $upcoming "startdate" -}} |
22 | | - {{- if ne ($.Scratch.Get "year") (dateFormat "2006" .startdate) -}} |
23 | | - {{- $.Scratch.Set "year" (dateFormat "2006" .startdate) -}} |
24 | | - {{- $.Scratch.Set "year-displayed" "false" -}} |
25 | | - {{- end -}} |
26 | | - {{- if ne ($.Scratch.Get "month") (dateFormat "January 2006" .startdate ) -}} |
27 | | - {{- $.Scratch.Set "month" (dateFormat "January 2006" .startdate ) -}} |
28 | | - {{- $.Scratch.Set "month-displayed" "false" -}} |
29 | | - {{- end -}} |
30 | | - {{- if ne ($.Scratch.Get "month-displayed") "true" -}} |
31 | | - {{- if eq ($.Scratch.Get "close-tag") "true"}} |
| 20 | + {{- $month := time.Format "January 2006" .startdate -}} |
| 21 | + {{- if ne $currentMonth $month -}} |
| 22 | + {{- $currentMonth = $month -}} |
| 23 | + {{- if $needsCloseTag -}} |
32 | 24 | </div> |
33 | 25 | {{- end -}} |
34 | | - <div class = "col-md-6 col-lg-3 events-page-col"> |
35 | | - <h4 class="events-page-months">{{ dateFormat "January 2006" .startdate }}</h4> |
36 | | - {{- $.Scratch.Set "month-displayed" "true" -}} |
37 | | - {{- $.Scratch.Set "close-tag" "true" -}} |
| 26 | + <div class="col-md-6 col-lg-3 events-page-col"> |
| 27 | + <h4 class="events-page-months">{{ $month }}</h4> |
| 28 | + {{- $needsCloseTag = true -}} |
38 | 29 | {{- end -}} |
39 | | - {{- if or (ne (time .startdate).Month (time .enddate).Month) (ne (time .startdate).Day (time .enddate).Day) -}} |
40 | | - <a href = '{{ (printf "/events/%s" .name) }}' class = "events-page-event"> |
41 | | - {{ dateFormat "Jan 2" .startdate }} - {{ dateFormat "2" .enddate }}: |
42 | | - {{ .city }} |
| 30 | + {{- $start := time.AsTime .startdate -}} |
| 31 | + {{- $end := time.AsTime .enddate -}} |
| 32 | + {{- if or (ne $start.Month $end.Month) (ne $start.Day $end.Day) -}} |
| 33 | + <a href='{{ printf "/events/%s" .name }}' class="events-page-event"> |
| 34 | + {{ time.Format "Jan 2" .startdate }} - {{ time.Format "2" .enddate }}: {{ .city }} |
43 | 35 | </a><br /> |
44 | 36 | {{- else -}} |
45 | | - <a href = '{{ (printf "/events/%s" .name) }}' class = "events-page-event"> |
46 | | - {{ dateFormat "Jan 2" .startdate }}: |
47 | | - {{ .city }} |
48 | | - </a><br /> |
| 37 | + <a href='{{ printf "/events/%s" .name }}' class="events-page-event"> |
| 38 | + {{ time.Format "Jan 2" .startdate }}: {{ .city }} |
| 39 | + </a><br /> |
49 | 40 | {{- end -}} |
50 | 41 | {{- end -}} |
51 | 42 | </div> |
52 | | -<div class = "col-md-6 col-lg-3 events-page-col"> |
53 | | -<h4 class="events-page-months">TBD</h4> |
54 | | -{{- range sort $tbd "city" -}} |
55 | | - <a href = '{{ (printf "/events/%s" .name) }}' class = "events-page-event">{{ .city }}</a><br /> |
56 | | -{{- end -}} |
| 43 | +<div class="col-md-6 col-lg-3 events-page-col"> |
| 44 | + <h4 class="events-page-months">TBD</h4> |
| 45 | + {{- range sort $tbd "city" -}} |
| 46 | + <a href='{{ printf "/events/%s" .name }}' class="events-page-event">{{ .city }}</a><br /> |
| 47 | + {{- end -}} |
57 | 48 | </div> |
58 | | - </div> |
59 | | -<!--past --> |
60 | | -<div class = "row"> |
61 | | - <div class = "col-md-12"> |
| 49 | +</div> |
| 50 | + |
| 51 | +<div class="row"> |
| 52 | + <div class="col-md-12"> |
62 | 53 | <h2>Past</h2> |
63 | 54 | </div> |
64 | 55 | </div> |
65 | | -<div class = "row"> |
66 | | - {{- $.Scratch.Set "close-tag" "false" -}} |
| 56 | +<div class="row"> |
| 57 | + {{- $currentYear := "" -}} |
| 58 | + {{- $needsCloseTag := false -}} |
67 | 59 | {{- range sort $events "startdate" -}} |
68 | | - {{- if and ( lt (dateFormat "2006-01-02" .enddate) (dateFormat "2006-01-02" (dateFormat "2006-01-02" now))) -}} |
69 | | - {{- if ne ($.Scratch.Get "year") (dateFormat "2006" .startdate) -}} |
70 | | - {{- $.Scratch.Set "year" (dateFormat "2006" .startdate) -}} |
71 | | - {{- $.Scratch.Set "year-displayed" "false" -}} |
72 | | - {{- end -}} |
73 | | - {{- if ne ($.Scratch.Get "year-displayed") "true" -}} |
74 | | - {{- if eq ($.Scratch.Get "close-tag") "true" -}} |
| 60 | + {{- if lt (time.Format "2006-01-02" .enddate) (time.Format "2006-01-02" now) -}} |
| 61 | + {{- $year := time.Format "2006" .startdate -}} |
| 62 | + {{- if ne $currentYear $year -}} |
| 63 | + {{- $currentYear = $year -}} |
| 64 | + {{- if $needsCloseTag -}} |
75 | 65 | </div> |
76 | 66 | {{- end -}} |
77 | | - <div class = "col-md-6 col-lg-3 events-page-col"> |
78 | | - <h4 class="events-page-months">{{ dateFormat "2006" .startdate }}</h4> |
79 | | - {{- $.Scratch.Set "year-displayed" "true" -}} |
80 | | - {{- $.Scratch.Set "close-tag" "true" -}} |
| 67 | + <div class="col-md-6 col-lg-3 events-page-col"> |
| 68 | + <h4 class="events-page-months">{{ $year }}</h4> |
| 69 | + {{- $needsCloseTag = true -}} |
81 | 70 | {{- end -}} |
82 | | - <a href='{{ (printf "/events/%s" .name) }}' class = "events-page-event">{{ .city }}</a> |
| 71 | + <a href='{{ printf "/events/%s" .name }}' class="events-page-event">{{ .city }}</a> |
83 | 72 | <br/> |
84 | 73 | {{- end -}} |
85 | 74 | {{- end -}} |
|
0 commit comments