2018-07-07 08:52:47 +00:00
|
|
|
{% extends "bases/bootstrap-with-nav.html" %}
|
|
|
|
{% load staticfiles %}
|
|
|
|
{% load bootstrap3 %}
|
|
|
|
|
|
|
|
{% block app_js_vars %}
|
2018-07-13 16:19:35 +00:00
|
|
|
const OPTION_COUNT = {{ object.options.count }};
|
|
|
|
const MIN_SELECTIONS = {{ min_selection }};
|
|
|
|
const MAX_SELECTIONS = {{ max_selection }};
|
2018-07-16 09:16:06 +00:00
|
|
|
const POLL_COUNT = {{ poll_count }};
|
|
|
|
const POLL_NUM = {{ poll_num }};
|
2018-07-13 16:19:35 +00:00
|
|
|
var selectedCount = 0;
|
2018-07-07 08:52:47 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
|
|
|
<div class="container">
|
2018-07-11 13:25:36 +00:00
|
|
|
{% if can_vote %}
|
|
|
|
<!-- Hidden fields -->
|
2018-07-13 16:19:35 +00:00
|
|
|
{% csrf_token %}
|
2018-07-11 13:25:36 +00:00
|
|
|
<input id="event-param" type="text" value="{{event.EID}}" hidden/>
|
|
|
|
<input id="comb_pk" type="text" value="{{event.public_key}}" hidden/>
|
2018-07-07 08:52:47 +00:00
|
|
|
|
2018-07-11 13:25:36 +00:00
|
|
|
<!-- Event info and instructions -->
|
|
|
|
<h2>Event Voting Page for the Event '{{ object.event.title }}'</h2>
|
|
|
|
<hr/>
|
|
|
|
<div class="alert alert-warning" role="alert" style="margin-top: 1em;">
|
|
|
|
You are voting as: <strong>{{ voter_email }}</strong> - Ensure this is correct and don't share this URL!
|
|
|
|
</div>
|
|
|
|
<span><strong>Voting status:</strong>
|
|
|
|
{% if has_voted %}
|
2018-08-22 16:39:41 +00:00
|
|
|
<span style="color: green; font-weight: bold">Voted - Re-submitting will change your vote</span>
|
2018-07-11 13:25:36 +00:00
|
|
|
{% else %}
|
2018-08-22 16:39:41 +00:00
|
|
|
<span style="color: red; font-weight: bold">Not Voted</span>
|
2018-07-11 13:25:36 +00:00
|
|
|
{% endif %}
|
|
|
|
</span>
|
|
|
|
<br/>
|
|
|
|
<span><strong>Number of polls for this event:</strong> {{ poll_count }}</span>
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|
<span><strong>Instructions:</strong>
|
|
|
|
You will be shown each poll for this event one by one where you will need to make a selection for the current
|
|
|
|
poll before moving onto the next poll. <strong>For this specific poll</strong> you need to make a <strong>
|
|
|
|
minimum</strong> of {{ min_selection }} option selection(s) and a <strong>maximum</strong> of
|
2018-07-13 16:19:35 +00:00
|
|
|
{{ max_selection }}.
|
|
|
|
|
|
|
|
{% if min_selection == 0 %}
|
|
|
|
<br/><br/>Due to the fact that you are permitted to select nothing, simply hitting submit will submit a
|
|
|
|
'blank' vote so please be aware of this. You can always re-visit this page before the event ends if you
|
|
|
|
change your mind.
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<br/><br/>Please make your choice below.
|
2018-07-11 13:25:36 +00:00
|
|
|
</span>
|
|
|
|
|
|
|
|
<!-- Poll Voting Section -->
|
2018-08-16 21:17:16 +00:00
|
|
|
<p id="poll-num" hidden>{{ poll_num}}</p>
|
2018-07-11 13:25:36 +00:00
|
|
|
<h3>Poll {{ poll_num }} of {{ poll_count }}: {{object.question_text}}</h3>
|
|
|
|
<hr/>
|
|
|
|
|
|
|
|
{% load crispy_forms_tags %}
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading"><strong>Options</strong></div>
|
|
|
|
<div class="panel panel-body">
|
2018-07-13 16:19:35 +00:00
|
|
|
{% comment %}<select class="radio-inline select form-control" id="poll-options" name="options">
|
2018-07-11 13:25:36 +00:00
|
|
|
{% load custom_filters_tags %}
|
|
|
|
<option value="{{ -1|get_ballot_value:object.options.all.count }}">Please Select...</option>
|
|
|
|
{% for option in object.options.all %}
|
|
|
|
<option value="{{forloop.counter|get_ballot_value:object.options.all.count}}">{{ option.choice_text }}</option>
|
|
|
|
{% endfor %}
|
2018-07-13 16:19:35 +00:00
|
|
|
</select>{% endcomment %}
|
|
|
|
{% for option in object.options.all %}
|
|
|
|
<div class="checkbox">
|
|
|
|
{% load custom_filters_tags %}
|
|
|
|
<label><input type="checkbox" value="{{forloop.counter|get_ballot_value:object.options.all.count}}">{{ option.choice_text }}</label>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
2018-07-11 13:25:36 +00:00
|
|
|
<hr/>
|
2018-07-13 16:19:35 +00:00
|
|
|
<div id="ballot-gen-progress-area">
|
|
|
|
<button id="gen-ballots-btn" class="btn btn-primary">Generate Ballots</button>
|
|
|
|
<!-- Progress bar which is used during encryption -->
|
|
|
|
<h4 id="progress-bar-description" class="hidden">Generating Ballots...</h4>
|
|
|
|
<div id="progress-bar-container" class="progress hidden">
|
|
|
|
<div id="progress-bar" class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
|
|
|
|
<span class="sr-only">70% Complete</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-07-11 13:25:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Poll Navigation -->
|
|
|
|
<div class="panel panel-body">
|
|
|
|
{% if prev_uuid %}
|
|
|
|
<a href="{% url 'polls:event-vote' event_id=object.event.uuid poll_id=prev_uuid %}?key={{ a_key }}" class="btn btn-danger"
|
|
|
|
role="button">
|
|
|
|
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> Previous Poll
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
{% if next_uuid %}
|
|
|
|
<a href="{% url 'polls:event-vote' event_id=object.event.uuid poll_id=next_uuid %}?key={{ a_key }}" class="btn btn-primary"
|
|
|
|
role="button" style="float: right;">
|
|
|
|
Next Poll <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2018-07-13 16:19:35 +00:00
|
|
|
|
|
|
|
<!-- Information Dialog called upon request -->
|
2018-08-22 16:39:41 +00:00
|
|
|
<div class="modal fade" id="modalDialog" role="dialog" tabindex="-1" data-backdrop="static">
|
|
|
|
<div class="modal-dialog" role="document">
|
2018-07-13 16:19:35 +00:00
|
|
|
|
|
|
|
<!-- Dialog content-->
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2018-07-17 08:57:09 +00:00
|
|
|
<h4 class="modal-title" style="text-align: center"><strong>Please Select a Ballot</strong></h4>
|
2018-07-13 16:19:35 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
2018-07-17 08:57:09 +00:00
|
|
|
<div class="choice-group">
|
|
|
|
<a id="choice-A" class="btn btn-sq btn-primary">
|
|
|
|
A
|
|
|
|
</a>
|
|
|
|
<a id="choice-B" class="btn btn-sq btn-warning choice">
|
|
|
|
B
|
|
|
|
</a>
|
|
|
|
</div>
|
2018-07-13 16:19:35 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2018-08-22 16:39:41 +00:00
|
|
|
<button id="cancelVoteBtn" type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
|
|
|
|
<button id="closeDialogBtn" type="button" class="btn btn-primary hidden" data-dismiss="modal">Close</button>
|
2018-07-13 16:19:35 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-07-11 13:25:36 +00:00
|
|
|
{% else %} <!-- for: { if can_vote %} -->
|
|
|
|
<div class="alert alert-warning" role="alert">
|
|
|
|
<p>{{ cant_vote_reason }}</p>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-07-07 08:52:47 +00:00
|
|
|
</div>
|
2018-07-11 13:25:36 +00:00
|
|
|
{% endblock %}
|