diff --git a/eosweb/core/main.py b/eosweb/core/main.py
index 68905ac..1d6d2bf 100644
--- a/eosweb/core/main.py
+++ b/eosweb/core/main.py
@@ -214,7 +214,26 @@ def tick_scheduler():
@app.route('/')
def index():
- return flask.render_template('index.html')
+ elections = Election.get_all()
+ elections.sort(key=lambda e: e.name)
+
+ elections_open = [e for e in elections if e.workflow.get_task('eos.base.workflow.TaskCloseVoting').status == WorkflowTaskStatus.READY]
+
+ elections_soon = [e for e in elections if e.workflow.get_task('eos.base.workflow.TaskCloseVoting').status != WorkflowTaskStatus.EXITED and e.workflow.get_task('eos.base.workflow.TaskOpenVoting').get_entry_task().run_at]
+ elections_soon.sort(key=lambda e: e.workflow.get_task('eos.base.workflow.TaskOpenVoting').get_entry_task().run_at)
+
+ elections_closed = [e for e in elections if e.workflow.get_task('eos.base.workflow.TaskCloseVoting').status == WorkflowTaskStatus.EXITED]
+ elections_closed.sort(key=lambda e: e.workflow.get_task('eos.base.workflow.TaskCloseVoting').exited_at, reverse=True)
+ elections_closed = elections_closed[:5]
+
+ return flask.render_template('index.html', elections_open=elections_open, elections_soon=elections_soon, elections_closed=elections_closed)
+
+@app.route('/elections')
+def elections():
+ elections = Election.get_all()
+ elections.sort(key=lambda e: e.name)
+
+ return flask.render_template('elections.html', elections=elections)
def using_election(func):
@functools.wraps(func)
diff --git a/eosweb/core/templates/elections.html b/eosweb/core/templates/elections.html
new file mode 100644
index 0000000..70049c9
--- /dev/null
+++ b/eosweb/core/templates/elections.html
@@ -0,0 +1,33 @@
+{% extends 'base.html' %}
+
+{#
+ Eos - Verifiable elections
+ Copyright © 2017-18 RunasSudo (Yingtong Li)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
Please choose an election from the list below:
+ +Please choose an election from the list below:
-