This commit is contained in:
Ross
2021-10-17 11:45:24 +01:00
parent 85e5a34cd6
commit 1b94bf6a9b
4 changed files with 28 additions and 15 deletions
+4 -11
View File
@@ -28,7 +28,7 @@
</div>
<div class="parent-help" title="Click to enable / disable the exam">
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %} data-posturl="{% url 'rapids:exam_toggle_active' pk=exam.pk %}"> <span
class="help-text">[When checked the exam will be available to take in the test system]</span>
</div>
{% if exam.exam_mode %}
@@ -72,7 +72,7 @@
{{ author }},
{% endfor %}
</div>
<p><button id='button-edit-order' title='click and drag questions to change order'>Edit exam order</button></p>
<p><button id='button-edit-order' title='click and drag questions to change order'>Edit question order / Delete questions</button></p>
<div>
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
JSON creation id: {{exam.exam_json_id}}
@@ -87,7 +87,8 @@
<script type="text/javascript">
$(document).ready(function () {
// send request to change the is_private state on customSwitches toggle
$("#exam-active-switch").on("change", function () {
$("#exam-active-switch").on("change", function (el) {
console.log(el)
$.ajax({
url: "{% url 'rapids:exam_toggle_active' pk=exam.pk %}",
data: {
@@ -195,14 +196,6 @@
$(this).remove();
sortable('.sortable');
$("#full-question-list li").each((n, el) => {
$(el).append($(
"<span class='exam-question-delete flex-col'><button>DELETE</button></span>"
).click(() => {
el.remove();
}));
})
$("#full-question-list").append($(
"<button title='click and drag questions to change order'>Save exam order</button>"
).click(() => {