General housekeeping such as adding package.json for Node server, bash script for launching a celery worker and updating the readme to assist with launching the DEMOS2 app. Updated some models to include UI helper functions. Main work done is around event preparation - with a Celery worker running and the Node server, trustees are now emailed a link to prepare events. The event detail page has also had a bit of an overhaul to include additional information and to make it easier to use
This commit is contained in:
parent
de9eaa7881
commit
f82a380fa4
21 changed files with 337 additions and 696 deletions
|
@ -150,7 +150,7 @@
|
|||
//new function
|
||||
demosEncrypt.generateKeys = function() {
|
||||
parameter = $("#event-param").val();
|
||||
var tempParams = JSON.parse(parameter);
|
||||
var tempParams = JSON.parse(JSON.parse(parameter).crypto);
|
||||
//the full objects need to be initalised as per the library, then copy the values we need into it
|
||||
//I follow Bingsheng's code as to what objects are used in the parameter object
|
||||
var ctx = new CTX("BN254CX"); //new context we can use
|
||||
|
|
|
@ -26,11 +26,13 @@
|
|||
}
|
||||
{% endfor %}
|
||||
];
|
||||
|
||||
{% if invalid_fields.poll_count %}pollCount = {{ invalid_fields.poll_count.val }};{% endif %}
|
||||
</script>
|
||||
|
||||
<!-- The following UI was ported from the Election Authority UI in DEMOS1 by Vincent de Almeida -->
|
||||
<!-- The DEMOS1 repository can be found at: https://github.com/mlevogiannis/demos-voting -->
|
||||
<!-- TODO: look into i18n translations as this was a feature implemented in DEMOS1 -->
|
||||
<!-- TODO: look into i18n translations as this was a feature implemented in DEMOS1 to enable automatic translations -->
|
||||
<div class="container">
|
||||
<div class="page-header">
|
||||
<h2>Create New Event with Polls</h2>
|
||||
|
@ -419,7 +421,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- { Hidden field: Number of Polls } -->
|
||||
<input type="number" id="poll-count-input" name="poll-count-input" class="hidden">
|
||||
<input type="number" id="poll-count-input" name="poll-count-input" class="hidden" {% if invalid_fields.poll_count %}value="{{ invalid_fields.poll_count.val }}"{% endif %}>
|
||||
<!-- Organisers -->
|
||||
<div class="form-group">
|
||||
<label for="organisers-input" class="col-sm-3 col-md-2 control-label">Organisers:</label> <!-- This text can be a template variable -->
|
||||
|
|
|
@ -5,35 +5,50 @@
|
|||
{% block content %}
|
||||
|
||||
<div class="container">
|
||||
<a href="{% url 'polls:index' %}"><< Back to Events List</a>
|
||||
<br/>
|
||||
<h1>Event: {{object.title}}</h1>
|
||||
<p>By {{object.users_organisers.all}}</p>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="{% block event_nav_details %}{% endblock %}">
|
||||
<a href="{% url 'polls:view-event' event.id %}">Details</a>
|
||||
</li>
|
||||
<li class="{% block event_nav_polls %}{% endblock %}">
|
||||
<a href="{% url 'polls:event-polls' event.id %}">Polls</a>
|
||||
</li>
|
||||
<li class="{% block event_nav_organisers %}{% endblock %}">
|
||||
<a href="{% url 'polls:event-organisers' event.id %}">Organisers</a>
|
||||
</li>
|
||||
{% if event.prepared == False and is_trustee %}
|
||||
<li class="">
|
||||
<a href="{% url 'polls:prepare-event' event.id %}">Prepare Event</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<a href="{% url 'polls:index' %}"><< Back to Events List</a>
|
||||
{% if is_organiser %}
|
||||
<li class="">
|
||||
<a href="{% url 'polls:edit-event' event.id %}"><span class="fa fa-pencil"></span> Edit Event</a>
|
||||
</li>
|
||||
<li class="{% block event_nav_launch %}{% endblock %}">
|
||||
<a href="{% url 'polls:launch-event' event.id %}">Launch Event</a>
|
||||
</li>
|
||||
<div>
|
||||
<!-- Heading -->
|
||||
<div class="col-xs-7 col-sm-9 col-md-10">
|
||||
<h2>Event: {{object.title}}</h2>
|
||||
</div>
|
||||
<!-- Edit Button -->
|
||||
<div class="col-xs-5 col-sm-3 col-md-2 marginTopEditButton">
|
||||
<a href="{% url 'polls:edit-event' event.id %}" class="btn btn-primary" style="float: right;">
|
||||
<span class="fa fa-pencil"></span> Edit
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<br/>
|
||||
<h2>Event: {{object.title}}</h2>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% block event_content %}{% endblock %}
|
||||
<div class="overviewPadding {% if is_organiser %}marginTopOverview{% endif %}">
|
||||
<hr/>
|
||||
<span>By: {{object.users_organisers.all}}</span>
|
||||
<br/>
|
||||
<span>Ready / Prepared: {{ object.prepared }}</span>
|
||||
<br/>
|
||||
<span>Event Status: {{ object.status }}</span>
|
||||
</div>
|
||||
<br/>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="{% block event_nav_details %}{% endblock %}">
|
||||
<a href="{% url 'polls:view-event' event.id %}"><strong>Summary</strong></a>
|
||||
</li>
|
||||
<li class="{% block event_nav_polls %}{% endblock %}">
|
||||
<a href="{% url 'polls:event-polls' event.id %}"><strong>Polls ({{ object.polls.count }})</strong></a>
|
||||
</li>
|
||||
<li class="{% block event_nav_organisers %}{% endblock %}">
|
||||
<a href="{% url 'polls:event-organisers' event.id %}"><strong>Entities</strong></a>
|
||||
</li>
|
||||
{% if is_organiser %}
|
||||
<li class="{% block event_nav_launch %}{% endblock %}">
|
||||
<a href="{% url 'polls:launch-event' event.id %}"><strong>Advanced</strong></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% block event_content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,10 +4,17 @@
|
|||
|
||||
{% block event_nav_details %}active{% endblock %}
|
||||
{% block event_content %}
|
||||
<h2>Event Details</h2>
|
||||
<span>Ready/Prepared: {{ event.prepared }}</span>
|
||||
<br />
|
||||
<span>Start Time: {{ event.start_time }}</span>
|
||||
<br />
|
||||
<span>End Time: {{ event.end_time }}</span>
|
||||
<br/>
|
||||
<span><strong>Start Time:</strong> {{ event.start_time_formatted_utc }}</span>
|
||||
<br />
|
||||
<span><strong>End Time:</strong> {{ event.end_time_formatted_utc }}</span>
|
||||
<br/>
|
||||
<br/>
|
||||
<span><strong>Number of Polls:</strong> {{ event.polls.count }}</span>
|
||||
<br/>
|
||||
<span><strong>Number of Organisers:</strong> {{ event.users_organisers.count }}</span>
|
||||
<br/>
|
||||
<span><strong>Number of Trustees:</strong> {{ event.users_trustees.count }}</span>
|
||||
<br/>
|
||||
<span><strong>Number of Voters:</strong> {{ event.voters.count }}</span>
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,11 +4,16 @@
|
|||
|
||||
{% block event_nav_launch %}active{% endblock %}
|
||||
{% block event_content %}
|
||||
<h2>Event Details</h2>
|
||||
<span>Trustee keys: {{ event.trustee_keys.count }} / {{ event.users_trustees.count }}</span>
|
||||
<br/>
|
||||
<span><strong>Trustee Keys Received:</strong> {{ event.trustee_keys.count }} / {{ event.users_trustees.count }}</span>
|
||||
<br />
|
||||
<span>EID (param): {{ event.EID }} </span>
|
||||
<br/>
|
||||
<span><strong>Human-readable Event ID:</strong> {{ event.EID_hr }} </span>
|
||||
<br />
|
||||
<span>Public key: {{ event.public_key }} </span>
|
||||
<br/>
|
||||
<span><strong>Group Param ID:</strong> {{ event.EID_crypto }} </span>
|
||||
<br />
|
||||
<br/>
|
||||
<span><strong>Public key:</strong> {{ event.public_key }} </span>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
{% block event_nav_organisers %}active{% endblock %}
|
||||
{% block event_content %}
|
||||
<h2>Event Organisers</h2>
|
||||
<h2>Event Organisers</h2>
|
||||
<hr/>
|
||||
{% if object.users_organisers.all %}
|
||||
<ul class="list-group">
|
||||
{% for user in object.users_organisers.all %}
|
||||
|
@ -14,7 +15,9 @@
|
|||
{% else %}
|
||||
<p>No organisers for this Event.</p>
|
||||
{% endif %}
|
||||
<h2>Event Trustees</h2>
|
||||
<hr/>
|
||||
<h2>Event Trustees</h2>
|
||||
<hr/>
|
||||
{% if object.users_trustees.all %}
|
||||
<ul class="list-group">
|
||||
{% for user in object.users_trustees.all %}
|
||||
|
@ -24,7 +27,9 @@
|
|||
{% else %}
|
||||
<p>No trustees for this Event.</p>
|
||||
{% endif %}
|
||||
<h2>Voters</h2>
|
||||
<hr/>
|
||||
<h2>Voters</h2>
|
||||
<hr/>
|
||||
{% if object.voters.all %}
|
||||
<ul class="list-group">
|
||||
{% for voter in object.voters.all %}
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
|
||||
{% block event_nav_polls %}active{% endblock %}
|
||||
{% block event_content %}
|
||||
<h2>Event Polls</h2>
|
||||
{% if object.polls.all %}
|
||||
{% for poll in object.polls.all %}
|
||||
<hr/>
|
||||
<h3>Poll: {{ poll.question_text }} (<a href="{% url 'polls:view-poll' event_id=event.id poll_num=forloop.counter %}">Edit</a>)</h3>
|
||||
<br/>
|
||||
<h4>Poll Options:</h4>
|
||||
|
@ -17,12 +15,12 @@
|
|||
{% endfor %}
|
||||
</ul>
|
||||
<p>Minimum Number of Option Selections: {{ poll.min_num_selections }}. Maximum Number of Option Selections: {{ poll.max_num_selections }}.</p>
|
||||
<hr/>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p>No polls are available for this Event.</p>
|
||||
{% endif %}
|
||||
{% if is_organiser %}
|
||||
<hr/>
|
||||
<a href="{% url 'polls:create-poll' event.id %}" class="btn btn-default" role="button">Add Poll</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -7,26 +7,29 @@
|
|||
{% block content %}
|
||||
|
||||
<div class="container">
|
||||
<h1>Event: {{event.title}}</h1>
|
||||
<h2>Trustee Setup</h2>
|
||||
<h2>Trustee Event Setup for Event '{{ event.title }}'</h2>
|
||||
<hr/>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Public Key</div>
|
||||
<div class="panel-heading"><strong>Step 1: Generate Your Secret Key</strong></div>
|
||||
<div class="panel panel-body">
|
||||
{% load crispy_forms_tags %}
|
||||
<form method="post" action="" class="">
|
||||
{% crispy form %}
|
||||
<input id="public-submit" class="btn btn-default" type="submit" value="Submit" disabled="true"/>
|
||||
</form>
|
||||
<input id="secret-key" class="textinput textInput form-control" type="text"/>
|
||||
<input id="event-param" type="text" value="{{event.EID}}" hidden/>
|
||||
<div class="alert alert-warning" role="alert" style="margin-top: 0.75em;">
|
||||
<strong>Warning:</strong> This key can <strong>NOT</strong> be recalculated if forgotten or lost! Ensure you back this up.
|
||||
</div>
|
||||
<button id="keygen-btn" onclick="demosEncrypt.generateKeys()" class="btn btn-success">Generate</button>
|
||||
<a id="download-btn" role="button" href="#" class="btn btn-primary" disabled>Download</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Secret Key</div>
|
||||
<div class="panel-heading"><strong>Step 2: Submit Your Public Key</strong></div>
|
||||
<div class="panel panel-body">
|
||||
<input id="secret-key" class="textinput textInput form-control" type="text"></input>
|
||||
<input id="event-param" type="text" value="{{event.EID}}" hidden></input>
|
||||
<p>Make a backup of this secret key before submitting your public key. This can NOT be recalculated if forgotten!</p>
|
||||
<button id="keygen-btn" onclick="demosEncrypt.generateKeys()" class="btn btn-default">Generate</button>
|
||||
<a id="download-btn" role="button" href="#" class="btn btn-default" disabled>Download</a>
|
||||
{% load crispy_forms_tags %}
|
||||
<form method="post" action="" class="">
|
||||
{% crispy form %}
|
||||
<p>Ensure your secret key is backed up before submitting.</p>
|
||||
<input id="public-submit" class="btn btn-danger" type="submit" value="Submit" disabled/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in a new issue