Custom nomenclature for election, referendum, poll, etc.

This commit is contained in:
RunasSudo 2017-12-04 14:30:41 +11:00
parent 41c588d0bf
commit d22f402cdc
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
4 changed files with 14 additions and 11 deletions

View File

@ -140,9 +140,12 @@ class RawResult(Result):
return combined
class Election(TopLevelObject):
_ver = StringField(default='0.2')
_id = UUIDField()
workflow = EmbeddedObjectField(Workflow) # Once saved, we don't care what kind of workflow it is
name = StringField()
kind = StringField(default='election')
voters = EmbeddedObjectListField(is_hashed=False)
questions = EmbeddedObjectListField()
results = EmbeddedObjectListField(is_hashed=False)

View File

@ -27,7 +27,7 @@
{% block content %}
<h1>{{ election.name }}</h1>
<p><small><b>Election fingerprint:</b> <span class="hash">{{ SHA256().update_obj(election).hash_as_b64() }}</span></small></p>
<p><small><b>{{ election.kind|title }} fingerprint:</b> <span class="hash">{{ SHA256().update_obj(election).hash_as_b64() }}</span></small></p>
<div class="ui secondary pointing menu" id="election-tab-menu">
{% include eosweb.core.main.model_view_map[election.__class__]['tabs'] %}

View File

@ -126,7 +126,7 @@
if (err) {
techDetails = '<p>Technical details: ' + err + '</p>';
}
$("#booth-content").html('<div class="ui error message"><p>We were unable to load the voting booth for this election. Please try again. If this problem persists, contact the election administrator.</p>' + techDetails + '</div>');
$("#booth-content").html('<div class="ui error message"><p>We were unable to load the voting booth for this {{ election.kind }}. Please try again. If this problem persists, contact the {{ election.kind }} administrator.</p>' + techDetails + '</div>');
}
function boothError(err) {
@ -135,7 +135,7 @@
if (err) {
techDetails = '<p>Technical details: ' + err + '</p>';
}
$("#booth-content").html('<div class="ui error message"><p>We were unable to display the next page of the voting booth. For your security, your ballot selections have been cleared. Please try again. If this problem persists, contact the election administrator.</p>' + techDetails + '</div>');
$("#booth-content").html('<div class="ui error message"><p>We were unable to display the next page of the voting booth. For your security, your ballot selections have been cleared. Please try again. If this problem persists, contact the {{ election.kind }} administrator.</p>' + techDetails + '</div>');
}
function showTemplate(template, opts, destination) {

View File

@ -25,17 +25,17 @@
{% if election.workflow.get_task('eos.base.workflow.TaskOpenVoting').status == Status.EXITED %}
{% if election.workflow.get_task('eos.base.workflow.TaskCloseVoting').status == Status.EXITED %}
{% if election.workflow.get_task('eos.base.workflow.TaskReleaseResults').status < Status.EXITED %}
<p><button class="ui huge button">Voting in this election has closed</button></p>
<p><button class="ui huge button">Voting in this {{ election.kind }} has closed</button></p>
{% endif %}
{% else %}
<p><a href="{{ url_for('election_booth', election_id=election._id) }}" class="ui huge primary button">Click here to vote in this election</a></p>
<p><a href="{{ url_for('election_booth', election_id=election._id) }}" class="ui huge primary button">Click here to vote in this {{ election.kind }}</a></p>
{% endif %}
{% else %}
<p><button class="ui huge button">Voting in this election has not yet opened</button></p>
<p><button class="ui huge button">Voting in this {{ election.kind }} has not yet opened</button></p>
{% endif %}
<p>
Voting in this election
Voting in this {{ election.kind }}
{% if election.workflow.get_task('eos.base.workflow.TaskOpenVoting').status == Status.EXITED %}
opened at {{ election.workflow.get_task('eos.base.workflow.TaskOpenVoting').exited_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC
{% else %}
@ -50,9 +50,9 @@
at the administrators' discretion.
</p>
{% else %}
<p><button class="ui huge button">This election is not yet ready for voting</button></p>
<p><button class="ui huge button">This {{ election.kind }} is not yet ready for voting</button></p>
<p>The administrator of this election has not yet finished setting the election parameters. The details of the election may change at any time.</p>
<p>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.</p>
{% endif %}
{% if election.workflow.get_task('eos.base.workflow.TaskReleaseResults').status == Status.EXITED %}
@ -69,10 +69,10 @@
{% if election.workflow.get_task('eos.base.workflow.TaskOpenVoting').status < Status.EXITED %}
<h2>Voting booth</h2>
<p>Voting in this election has not yet begun. If you would like to preview the voting booth, <a href="{{ url_for('election_booth', election_id=election._id) }}">click here</a>. Note that you will not be able to cast any ballots until voting opens.</p>
<p>Voting in this {{ election.kind }} has not yet begun. If you would like to preview the voting booth, <a href="{{ url_for('election_booth', election_id=election._id) }}">click here</a>. Note that you will not be able to cast any ballots until voting opens.</p>
{% elif election.workflow.get_task('eos.base.workflow.TaskCloseVoting').status == Status.EXITED %}
<h2>Voting booth</h2>
<p>Voting in this election has concluded. If you would like to review the voting booth, <a href="{{ url_for('election_booth', election_id=election._id) }}">click here</a>. Note that you will no longer be able to cast any ballots.</p>
<p>Voting in this {{ election.kind }} has concluded. If you would like to review the voting booth, <a href="{{ url_for('election_booth', election_id=election._id) }}">click here</a>. Note that you will no longer be able to cast any ballots.</p>
{% endif %}
{% endblock %}