|
9 | 9 | {% assign firstYearNum = firstYear | plus: 0 %}
|
10 | 10 | {% capture lastYear %}{{include.collection.last.date | date: "%Y"}}{% endcapture %}
|
11 | 11 | {% assign lastYearNum = lastYear | plus: 0 %}
|
| 12 | + {% if page.reversed == false %} |
| 13 | + {% for y in (firstYear..lastYear) %} |
| 14 | + {% for m in (1..12) %} |
| 15 | + {% assign currentMonthEvents = '' | split: ','' %} |
12 | 16 |
|
13 |
| - {% for y in (firstYear..lastYear) %} |
14 |
| - {% for m in (1..12) %} |
15 |
| - {% assign currentMonthEvents = '' | split: ','' %} |
| 17 | + {% for event in include.collection %} |
| 18 | + {% capture year %}{{event.date | date: "%Y"}}{% endcapture %} |
| 19 | + {% assign yearNum = year | plus: 0 %} |
| 20 | + {% capture month %}{{event.date | date: "%m"}}{% endcapture %} |
| 21 | + {% assign monthNum = month | plus: 0 %} |
| 22 | + {% if monthNum == m and yearNum == y %} |
| 23 | + {% assign currentMonthEvents = currentMonthEvents | push: event %} |
| 24 | + {% endif %} |
| 25 | + {% endfor %} |
16 | 26 |
|
17 |
| - {% for event in include.collection %} |
18 |
| - {% capture year %}{{event.date | date: "%Y"}}{% endcapture %} |
19 |
| - {% assign yearNum = year | plus: 0 %} |
20 |
| - {% capture month %}{{event.date | date: "%m"}}{% endcapture %} |
21 |
| - {% assign monthNum = month | plus: 0 %} |
22 |
| - {% if monthNum == m and yearNum == y %} |
23 |
| - {% assign currentMonthEvents = currentMonthEvents | push: event %} |
24 |
| - {% endif %} |
25 |
| - {% endfor %} |
| 27 | + {% capture monthName %} |
| 28 | + {% case m %} |
| 29 | + {% when 1 %}January |
| 30 | + {% when 2 %}February |
| 31 | + {% when 3 %}March |
| 32 | + {% when 4 %}April |
| 33 | + {% when 5 %}May |
| 34 | + {% when 6 %}June |
| 35 | + {% when 7 %}July |
| 36 | + {% when 8 %}August |
| 37 | + {% when 9 %}September |
| 38 | + {% when 10 %}October |
| 39 | + {% when 11 %}November |
| 40 | + {% when 12 %}December |
| 41 | + {% endcase %} |
| 42 | + {% endcapture %} |
26 | 43 |
|
27 |
| - {% capture monthName %} |
28 |
| - {% case m %} |
29 |
| - {% when 1 %}January |
30 |
| - {% when 2 %}February |
31 |
| - {% when 3 %}March |
32 |
| - {% when 4 %}April |
33 |
| - {% when 5 %}May |
34 |
| - {% when 6 %}June |
35 |
| - {% when 7 %}July |
36 |
| - {% when 8 %}August |
37 |
| - {% when 9 %}September |
38 |
| - {% when 10 %}October |
39 |
| - {% when 11 %}November |
40 |
| - {% when 12 %}December |
41 |
| - {% endcase %} |
42 |
| - {% endcapture %} |
| 44 | + {% for event in currentMonthEvents %} |
| 45 | + {% capture year %}{{event.date | date: "%Y"}}{% endcapture %} |
| 46 | + {% capture day %}{{event.date | date: "%d"}}{% endcapture %} |
| 47 | + {% if forloop.first %} |
| 48 | + <h3>{{monthName}} {{year}}</h3> |
| 49 | + <div class="training-list"> |
| 50 | + {% endif %} |
43 | 51 |
|
44 |
| - {% for event in currentMonthEvents %} |
45 |
| - {% capture year %}{{event.date | date: "%Y"}}{% endcapture %} |
46 |
| - {% capture day %}{{event.date | date: "%d"}}{% endcapture %} |
47 |
| - {% if forloop.first %} |
48 |
| - <h3>{{monthName}} {{year}}</h3> |
49 |
| - <div class="training-list"> |
50 |
| - {% endif %} |
| 52 | + <a href="{{event.link-out}}" class="training-item"> |
| 53 | + {% if event.logo %} |
| 54 | + <img src="{{event.logo}}" alt="{{event.title}}"> |
| 55 | + {% else %} |
| 56 | + <div class="calendar"> |
| 57 | + <span>{{monthName | truncate: 9, "" | upcase}}</span> |
| 58 | + <span>{{day}}</span> |
| 59 | + </div> |
| 60 | + {% endif %} |
| 61 | + <div class="training-text"> |
| 62 | + <h4>{{event.title | upcase}}</h4> |
| 63 | + <p>{{event.location}}</p> |
| 64 | + {% if event.organizer %} |
| 65 | + <p>{{event.organizer}}</p> |
| 66 | + {% else %} |
| 67 | + <p>{{event.start}}{% if event.start != event.end %} - {{event.end}}{% endif %}</p> |
| 68 | + {% endif %} |
| 69 | + </div> |
| 70 | + </a> |
51 | 71 |
|
52 |
| - <a href="{{event.link-out}}" class="training-item"> |
53 |
| - {% if event.logo %} |
54 |
| - <img src="{{event.logo}}" alt="{{event.title}}"> |
55 |
| - {% else %} |
56 |
| - <div class="calendar"> |
57 |
| - <span>{{monthName | truncate: 9, "" | upcase}}</span> |
58 |
| - <span>{{day}}</span> |
| 72 | + {% if forloop.last %} |
59 | 73 | </div>
|
60 | 74 | {% endif %}
|
61 |
| - <div class="training-text"> |
62 |
| - <h4>{{event.title | upcase}}</h4> |
63 |
| - <p>{{event.location}}</p> |
64 |
| - {% if event.organizer %} |
65 |
| - <p>{{event.organizer}}</p> |
| 75 | + {% endfor %} |
| 76 | + {% endfor %} |
| 77 | + {% endfor %} |
| 78 | + {% else %} |
| 79 | + {% for y in (firstYear..lastYear) reversed %} |
| 80 | + {% for m in (1..12) reversed %} |
| 81 | + {% assign currentMonthEvents = '' | split: ','' %} |
| 82 | + |
| 83 | + {% for event in include.collection %} |
| 84 | + {% capture year %}{{event.date | date: "%Y"}}{% endcapture %} |
| 85 | + {% assign yearNum = year | plus: 0 %} |
| 86 | + {% capture month %}{{event.date | date: "%m"}}{% endcapture %} |
| 87 | + {% assign monthNum = month | plus: 0 %} |
| 88 | + {% if monthNum == m and yearNum == y %} |
| 89 | + {% assign currentMonthEvents = currentMonthEvents | push: event %} |
| 90 | + {% endif %} |
| 91 | + {% endfor %} |
| 92 | + |
| 93 | + {% capture monthName %} |
| 94 | + {% case m %} |
| 95 | + {% when 1 %}January |
| 96 | + {% when 2 %}February |
| 97 | + {% when 3 %}March |
| 98 | + {% when 4 %}April |
| 99 | + {% when 5 %}May |
| 100 | + {% when 6 %}June |
| 101 | + {% when 7 %}July |
| 102 | + {% when 8 %}August |
| 103 | + {% when 9 %}September |
| 104 | + {% when 10 %}October |
| 105 | + {% when 11 %}November |
| 106 | + {% when 12 %}December |
| 107 | + {% endcase %} |
| 108 | + {% endcapture %} |
| 109 | + |
| 110 | + {% for event in currentMonthEvents %} |
| 111 | + {% capture year %}{{event.date | date: "%Y"}}{% endcapture %} |
| 112 | + {% capture day %}{{event.date | date: "%d"}}{% endcapture %} |
| 113 | + {% if forloop.first %} |
| 114 | + <h3>{{monthName}} {{year}}</h3> |
| 115 | + <div class="training-list"> |
| 116 | + {% endif %} |
| 117 | + |
| 118 | + <a href="{{event.link-out}}" class="training-item"> |
| 119 | + {% if event.logo %} |
| 120 | + <img src="{{event.logo}}" alt="{{event.title}}"> |
66 | 121 | {% else %}
|
67 |
| - <p>{{event.start}}{% if event.start != event.end %} - {{event.end}}{% endif %}</p> |
| 122 | + <div class="calendar"> |
| 123 | + <span>{{monthName | truncate: 9, "" | upcase}}</span> |
| 124 | + <span>{{day}}</span> |
| 125 | + </div> |
68 | 126 | {% endif %}
|
69 |
| - </div> |
70 |
| - </a> |
| 127 | + <div class="training-text"> |
| 128 | + <h4>{{event.title | upcase}}</h4> |
| 129 | + <p>{{event.location}}</p> |
| 130 | + {% if event.organizer %} |
| 131 | + <p>{{event.organizer}}</p> |
| 132 | + {% else %} |
| 133 | + <p>{{event.start}}{% if event.start != event.end %} - {{event.end}}{% endif %}</p> |
| 134 | + {% endif %} |
| 135 | + </div> |
| 136 | + </a> |
71 | 137 |
|
72 |
| - {% if forloop.last %} |
73 |
| - </div> |
74 |
| - {% endif %} |
75 |
| - {% endfor %} |
76 |
| - {% endfor %} |
77 |
| - {% endfor %} |
| 138 | + {% if forloop.last %} |
| 139 | + </div> |
| 140 | + {% endif %} |
| 141 | + {% endfor %} |
| 142 | + {% endfor %} |
| 143 | + {% endfor %} |
| 144 | + {% endif %} |
0 commit comments