Eos/eosweb/core/static/nunjucks/booth/selections.html

68 lines
2.2 KiB
HTML

{% extends templates['booth/base.html'] %}
{#
Eos - Verifiable elections
Copyright © 2017-2019 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 <http://www.gnu.org/licenses/>.
#}
{% block content %}
<div id="question-box" class="ui container"></div>
{% endblock %}
{% block buttons %}
<button class="ui left floated button" onclick="previousQuestion();">Back</button>
<button class="ui right floated primary button" onclick="nextQuestion();">Continue</button>
{% endblock %}
{% block after %}
<script>
function saveSelections() {
boothError("Question template unable to save selections");
}
function loadHelp() {
$("#modal-help .content").html($("#selections-make-help").html());
}
showTemplate(selection_model_view_map[election.questions.__getitem__(booth.questionNum)._name]["selections_make"], { "questionNum": booth.questionNum }, "#question-box");
loadHelp();
function previousQuestion() {
saveSelections();
if (booth.questionNum == 0) {
prevTemplate();
} else {
booth.questionNum--;
showTemplate(selection_model_view_map[election.questions.__getitem__(booth.questionNum)._name]["selections_make"], { "questionNum": booth.questionNum }, "#question-box");
loadHelp();
}
}
function nextQuestion() {
if (!saveSelections()) {
return;
}
if (booth.questionNum == election.questions.__len__() - 1) {
nextTemplate();
} else {
booth.questionNum++;
showTemplate(selection_model_view_map[election.questions.__getitem__(booth.questionNum)._name]["selections_make"], { "questionNum": booth.questionNum }, "#question-box");
loadHelp();
}
}
</script>
{% endblock %}