election/doc/source/_exts/events.jinja
Tristan Cacqueray 8791d36b37 Rewrite the event logic in javascript
The current events extension is computing the statuses at build time,
which is getting incorrect when an event is outdated until there is
a rebuild. This change fix that by doing the event status computation
at load time in javascript.

Moreover this change removes an unused import in utils.

Change-Id: Ifd1b84ff0182cf9bb7950da3d59f36c83019ac30
2017-01-30 01:48:11 +00:00

22 lines
1018 B
Django/Jinja

.. raw:: html
<span id="eventname"></span>
<span id="eventtimer"></span>
<script>
var events_timeline = [
{% for event in events %}
{ start: "{{ event['start_iso'] }}", end: "{{ event['end_iso'] }}", name: "{{ event['name'] }}" },
{% endfor %}
];
</script>
<br /><br />
+------------------------------------+------------------------------------+------------------------------------+-----------+
| Events | Start Date | End Date | Status |
+====================================+====================================+====================================+===========+
{% for event in events %}
| {{ "%29s" % event['name'] }} | {{ "%29s" % event['start_str'] }} | {{ "%29s" % event['end_str'] }} | |
+------------------------------------+------------------------------------+------------------------------------+-----------+
{% endfor %}