From 1ddcf4b5b2bd5cf1c8066a5f40bbf559ff1dc4f4 Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 1 Aug 2021 10:45:07 +0100 Subject: [PATCH] . --- longs/templates/longs/exam_overview.html | 118 ++++++++++++----------- 1 file changed, 60 insertions(+), 58 deletions(-) diff --git a/longs/templates/longs/exam_overview.html b/longs/templates/longs/exam_overview.html index 6e426ccb..1541ad9b 100644 --- a/longs/templates/longs/exam_overview.html +++ b/longs/templates/longs/exam_overview.html @@ -6,7 +6,7 @@
Admin Edit

Exam: {{ exam.name }}

- This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.
+ This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.
Exam mode: {{ exam.exam_mode }} {% if exam.exam_mode %} @@ -15,7 +15,9 @@ class="help-text">[When checked the exam will be available to take in the test system]
- Publish results: [When checked the exam results will be available on this site] + Publish results: [When checked the exam results will + be available on this site]
{% endif %}

@@ -54,7 +56,7 @@
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}), JSON creation id: {{exam.exam_json_id}} - {% if question.recreate_json %}[JSON out of date]{% endif %} + {% if exam.recreate_json %}[JSON out of date]{% endif %}
JSON Refresh JSON cache @@ -67,14 +69,14 @@ // send request to change the is_private state on customSwitches toggle $("#exam-active-switch").on("change", function () { $.ajax({ - url: "{% url 'longs:exam_toggle_active' pk=exam.pk %}", - data: { - csrfmiddlewaretoken: "{{ csrf_token }}", - active: this.checked // true if checked else false - }, - type: "POST", - dataType: "json", - }) + url: "{% url 'longs:exam_toggle_active' pk=exam.pk %}", + data: { + csrfmiddlewaretoken: "{{ csrf_token }}", + active: this.checked // true if checked else false + }, + type: "POST", + dataType: "json", + }) // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly .done(function (data) { console.log(data); @@ -91,14 +93,14 @@ }) $("#exam-publish-results-switch").on("change", function () { $.ajax({ - url: "{% url 'longs:exam_toggle_results_published' pk=exam.pk %}", - data: { - csrfmiddlewaretoken: "{{ csrf_token }}", - publish_results: this.checked // true if checked else false - }, - type: "POST", - dataType: "json", - }) + url: "{% url 'longs:exam_toggle_results_published' pk=exam.pk %}", + data: { + csrfmiddlewaretoken: "{{ csrf_token }}", + publish_results: this.checked // true if checked else false + }, + type: "POST", + dataType: "json", + }) // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly .done(function (data) { console.log(data); @@ -115,14 +117,14 @@ }) $("#button-open-access").click(function () { $.ajax({ - url: "{% url 'longs:exam_json_edit' pk=exam.pk %}", - data: { - csrfmiddlewaretoken: "{{ csrf_token }}", - set_open_access: true, - }, - type: "POST", - dataType: "json", - }) + url: "{% url 'longs:exam_json_edit' pk=exam.pk %}", + data: { + csrfmiddlewaretoken: "{{ csrf_token }}", + set_open_access: true, + }, + type: "POST", + dataType: "json", + }) // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly .done(function (data) { console.log(data); @@ -137,14 +139,14 @@ }) $("#button-closed-access").click(function () { $.ajax({ - url: "{% url 'longs:exam_json_edit' pk=exam.pk %}", - data: { - csrfmiddlewaretoken: "{{ csrf_token }}", - set_open_access: false, - }, - type: "POST", - dataType: "json", - }) + url: "{% url 'longs:exam_json_edit' pk=exam.pk %}", + data: { + csrfmiddlewaretoken: "{{ csrf_token }}", + set_open_access: false, + }, + type: "POST", + dataType: "json", + }) // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly .done(function (data) { console.log(data); @@ -162,30 +164,30 @@ sortable('.sortable'); $("#full-question-list").append($("").click(() => { - new_order = []; - $("#full-question-list li").each((n, el) => { - new_order.push(el.dataset.question_pk) - }) - $.ajax({ - url: "{% url 'longs:exam_json_edit' pk=exam.pk %}", - data: { - csrfmiddlewaretoken: "{{ csrf_token }}", - set_exam_order: JSON.stringify(new_order), - }, - type: "POST", - dataType: "json", - }) - // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly - .done(function (data) { - console.log(data); + new_order = []; + $("#full-question-list li").each((n, el) => { + new_order.push(el.dataset.question_pk) + }) + $.ajax({ + url: "{% url 'longs:exam_json_edit' pk=exam.pk %}", + data: { + csrfmiddlewaretoken: "{{ csrf_token }}", + set_exam_order: JSON.stringify(new_order), + }, + type: "POST", + dataType: "json", + }) + // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly + .done(function (data) { + console.log(data); - if (data.status == "success") { - toastr.info('Exam order changed.') - } - }) - .always(function () { - console.log('[Done]'); - }) + if (data.status == "success") { + toastr.info('Exam order changed.') + } + }) + .always(function () { + console.log('[Done]'); + }) })); }); });