diff --git a/eosweb/core/main.py b/eosweb/core/main.py index b0aa3fe..9f0d627 100644 --- a/eosweb/core/main.py +++ b/eosweb/core/main.py @@ -16,6 +16,7 @@ import click import flask +import timeago from eos.core.objects import * from eos.core.tasks import * @@ -154,6 +155,10 @@ def verify_election(electionid): def inject_globals(): return {'eos': eos, 'eosweb': eosweb, 'SHA256': eos.core.hashing.SHA256} +@app.template_filter('pretty_date') +def pretty_date(dt): + return flask.Markup(''.format(dt.strftime('%Y-%m-%dT%H:%M:%SZ'), dt.strftime('%Y-%m-%d %H:%M:%S UTC'), timeago.format(dt, datetime.now()))) + # Tickle the plumbus every request @app.before_request def tick_scheduler(): diff --git a/eosweb/core/static/css/main.css b/eosweb/core/static/css/main.css index 53b39f2..3849153 100644 --- a/eosweb/core/static/css/main.css +++ b/eosweb/core/static/css/main.css @@ -32,6 +32,10 @@ text-decoration: underline; } +time[title] { + text-decoration: underline dotted; +} + /* Default of 1.25rem is too small for our long lists… */ .ui.ordered.list, .ui.ordered.list .list, ol.ui.list, ol.ui.list ol { margin-left: 1.75rem; diff --git a/eosweb/core/templates/active_tasks_menu.html b/eosweb/core/templates/active_tasks_menu.html index 2240172..4a9c778 100644 --- a/eosweb/core/templates/active_tasks_menu.html +++ b/eosweb/core/templates/active_tasks_menu.html @@ -26,17 +26,26 @@
diff --git a/eosweb/core/templates/election/view/view.html b/eosweb/core/templates/election/view/view.html index 59e9008..a553b7c 100644 --- a/eosweb/core/templates/election/view/view.html +++ b/eosweb/core/templates/election/view/view.html @@ -33,56 +33,56 @@ {% else %} {% endif %} - -- Voting in this {{ election.kind }} - {% if election.workflow.get_task('eos.base.workflow.TaskOpenVoting').status == Status.EXITED %} - opened at - {% if election.workflow.get_task('eos.base.workflow.TaskOpenVoting').get_entry_task().run_at %} - {{ election.workflow.get_task('eos.base.workflow.TaskOpenVoting').get_entry_task().run_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC - according to schedule, - {% else %} - {{ election.workflow.get_task('eos.base.workflow.TaskOpenVoting').exited_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC - at the administrator's discretion, - {% endif %} - {% else %} - is scheduled to open at - {% if election.workflow.get_task('eos.base.workflow.TaskOpenVoting').get_entry_task().run_at %} - {{ election.workflow.get_task('eos.base.workflow.TaskOpenVoting').get_entry_task().run_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC, - {% else %} - the administrator's discretion, - {% endif %} - {% endif %} - and - {% if election.workflow.get_task('eos.base.workflow.TaskCloseVoting').status == Status.EXITED %} - closed at - {% if election.workflow.get_task('eos.base.workflow.TaskCloseVoting').get_entry_task().run_at %} - {{ election.workflow.get_task('eos.base.workflow.TaskCloseVoting').get_entry_task().run_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC - according to schedule - {% else %} - {{ election.workflow.get_task('eos.base.workflow.TaskCloseVoting').exited_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC - at the administrator's discretion - {% endif %} - {% else %} - is scheduled to close at - {% if election.workflow.get_task('eos.base.workflow.TaskCloseVoting').get_entry_task().run_at %} - {{ election.workflow.get_task('eos.base.workflow.TaskCloseVoting').get_entry_task().run_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC. - {% else %} - the administrator's discretion. - {% endif %} - {% endif %} -
{% else %}The administrator of this {{ election.kind }} has not yet finished setting the election parameters. The details of the {{ election.kind }} may change at any time.
{% endif %} ++ Voting in this {{ election.kind }} + {% if election.workflow.get_task('eos.base.workflow.TaskOpenVoting').status == Status.EXITED %} + opened + {% if election.workflow.get_task('eos.base.workflow.TaskOpenVoting').get_entry_task().run_at %} + {{ election.workflow.get_task('eos.base.workflow.TaskOpenVoting').get_entry_task().run_at|pretty_date }} + according to schedule, + {% else %} + {{ election.workflow.get_task('eos.base.workflow.TaskOpenVoting').exited_at|pretty_date }} + at the administrator's discretion, + {% endif %} + {% else %} + is scheduled to open + {% if election.workflow.get_task('eos.base.workflow.TaskOpenVoting').get_entry_task().run_at %} + {{ election.workflow.get_task('eos.base.workflow.TaskOpenVoting').get_entry_task().run_at|pretty_date }}, + {% else %} + the administrator's discretion, + {% endif %} + {% endif %} + and + {% if election.workflow.get_task('eos.base.workflow.TaskCloseVoting').status == Status.EXITED %} + closed + {% if election.workflow.get_task('eos.base.workflow.TaskCloseVoting').get_entry_task().run_at %} + {{ election.workflow.get_task('eos.base.workflow.TaskCloseVoting').get_entry_task().run_at|pretty_date }} + according to schedule. + {% else %} + {{ election.workflow.get_task('eos.base.workflow.TaskCloseVoting').exited_at|pretty_date }} + at the administrator's discretion. + {% endif %} + {% else %} + is scheduled to close + {% if election.workflow.get_task('eos.base.workflow.TaskCloseVoting').get_entry_task().run_at %} + {{ election.workflow.get_task('eos.base.workflow.TaskCloseVoting').get_entry_task().run_at|pretty_date }}. + {% else %} + the administrator's discretion. + {% endif %} + {% endif %} +
+ {% if (session.user and session.user.is_admin() and election.workflow.get_task('eos.base.workflow.TaskReleaseResults').status == Status.READY) or election.workflow.get_task('eos.base.workflow.TaskReleaseResults').status == Status.EXITED %}Results were released at {{ election.workflow.get_task('eos.base.workflow.TaskReleaseResults').exited_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC.
+Results were released at {{ election.workflow.get_task('eos.base.workflow.TaskReleaseResults').exited_at|pretty_date }}.
{% else %}