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

68 lines
2.2 KiB
HTML
Raw Permalink Normal View History

2017-11-23 21:07:16 +11:00
{% extends templates['booth/base.html'] %}
{#
Eos - Verifiable elections
2019-01-14 17:54:31 +11:00
Copyright © 2017-2019 RunasSudo (Yingtong Li)
2017-11-23 21:07:16 +11:00
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 %}
2017-12-11 17:35:12 +11:00
<button class="ui left floated button" onclick="previousQuestion();">Back</button>
2017-11-23 21:07:16 +11:00
<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();
2017-11-23 21:07:16 +11:00
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();
2017-11-23 21:07:16 +11:00
}
}
function nextQuestion() {
2018-01-05 20:12:23 +11:00
if (!saveSelections()) {
return;
}
if (booth.questionNum == election.questions.__len__() - 1) {
2017-11-23 21:07:16 +11:00
nextTemplate();
} else {
booth.questionNum++;
showTemplate(selection_model_view_map[election.questions.__getitem__(booth.questionNum)._name]["selections_make"], { "questionNum": booth.questionNum }, "#question-box");
loadHelp();
2017-11-23 21:07:16 +11:00
}
}
</script>
{% endblock %}