Skip to content

Commit a1b21bf

Browse files
committed
Prune away past events and trainings.
Both at the Jekyll level and at the JavaScript level.
1 parent e52fd46 commit a1b21bf

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
isevent: true
3+
title: Outdated event
4+
logo: http://photos.osmek.com/95149
5+
location: Lausanne, Switzerland
6+
description: This event is outdated and should not appear in the JavaScript code
7+
start: 15 February 2013
8+
end: 19 February 2013
9+
url: http://www.epfl.ch/
10+
---

resources/js/main.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,24 @@ $(document).ready(function(){
6969
}
7070

7171
var scalaLangEvents = [
72-
{% for event in site.categories.events limit:5 %}
72+
{% for event in site.categories.events %}
73+
{% if event.date >= site.time %}{% comment %} No point in including outdated events {% endcomment %}
7374
{
7475
"title": "{{ event.title }}",
7576
"logo": "{{ event.logo }}",
7677
"location": "{{ event.location }}",
7778
"start": "{{ event.start }}",
7879
"end": "{{ event.end }}",
7980
"url": "{{ event.url }}",
80-
}{% unless forloop.last %},{% endunless %}
81+
},
82+
{% endif %}
8183
{% endfor%}
8284
];
8385

8486
function doPopulateEventsPane(allEvents) {
87+
allEvents = allEvents.filter(function (event) {
88+
return (event.end ? new Date(event.end) : new Date(event.start)) >= new Date();
89+
});
8590
allEvents.sort(compareEventsByDate);
8691
var content = "";
8792
for (i = 0; i < allEvents.length && i < MAX_EVENTS; i++) {
@@ -123,7 +128,8 @@ $(document).ready(function(){
123128
}
124129

125130
var scalaLangTrainings = [
126-
{% for training in site.categories.training limit:5 %}
131+
{% for training in site.categories.training %}
132+
{% if training.date >= site.time %}{% comment %} No point in including outdated training sessions {% endcomment %}
127133
{
128134
title: "{{ training.title }}",
129135
description: "{{ training.description }}",
@@ -137,7 +143,8 @@ $(document).ready(function(){
137143
status: "{{ training.status }}"
138144
}
139145
]
140-
}{% unless forloop.last %},{% endunless %}
146+
},
147+
{% endif %}
141148
{% endfor%}
142149
];
143150

@@ -162,6 +169,9 @@ $(document).ready(function(){
162169

163170
function doPopulateTrainingsPane(allTrainings0) {
164171
var allTrainings = keepOnlyOneSession(allTrainings0);
172+
allTrainings = allTrainings.filter(function (training) {
173+
return new Date(training.when) >= new Date();
174+
});
165175
allTrainings.sort(compareTrainingsByDate);
166176
var content = "";
167177
for (i = 0; i < allTrainings.length; i++) {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
istraining: true
3+
title: Outdated training
4+
description: This outdated training should not appear in the JavaScript
5+
url: http://www.epfl.ch/
6+
where: Lausanne, Switzerland
7+
when: 18 February 2013
8+
trainers: Sébastien Doeraene
9+
organizer: EPFL
10+
status: unknown
11+
---

training/_posts/2013-02-23-testtraining.md renamed to training/_posts/2013-03-23-testtraining.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Test training
44
description: This a cool test training
55
url: http://www.epfl.ch/
66
where: Lausanne, Switzerland
7-
when: 23 February 2013
7+
when: 23 March 2013
88
trainers: Sébastien Doeraene
99
organizer: EPFL
1010
status: unknown

0 commit comments

Comments
 (0)