From df381ea0ad7b586c1ddbcb73badfac3c197c27b0 Mon Sep 17 00:00:00 2001 From: Ross Date: Sat, 21 Aug 2021 09:16:15 +0100 Subject: [PATCH] . --- sbas/templates/sbas/exam_overview.html | 71 ++++++++++++-------------- 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/sbas/templates/sbas/exam_overview.html b/sbas/templates/sbas/exam_overview.html index c214ca23..beae151e 100644 --- a/sbas/templates/sbas/exam_overview.html +++ b/sbas/templates/sbas/exam_overview.html @@ -8,10 +8,13 @@ This exam has {{question_number}} questions.
- Exam active: [When checked the exam will be available to take in the test system] + Exam active: [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]
This exam will be available to take here (when active). @@ -21,26 +24,18 @@ {% for question in questions.all %}
  • + {{ question.stem|safe }}
      -
    1. - {{ question.a_answer|safe }} -
    2. -
    3. - {{ question.b_answer|safe }} -
    4. -
    5. - {{ question.c_answer|safe }} -
    6. -
    7. - {{ question.d_answer|safe }} -
    8. -
    9. - {{ question.e_answer|safe }} -
    10. - Best answer : {{question.best_answer}} -
    - Category: {{ question.category }}, View Edit +
  • {{ question.a_answer|safe }}
  • +
  • {{ question.b_answer|safe }}
  • +
  • {{ question.c_answer|safe }}
  • +
  • {{ question.d_answer|safe }}
  • +
  • {{ question.e_answer|safe }}
  • Best answer : {{question.best_answer}} + + + Category: {{ question.category }}, View Edit {% endfor %} @@ -53,20 +48,20 @@ // send request to change the is_private state on customSwitches toggle $("#exam-active-switch").on("change", function () { $.ajax({ - url: "{% url 'sbas:exam_toggle_active' pk=exam.pk %}", - data: { - csrfmiddlewaretoken: "{{ csrf_token }}", - active: this.checked // true if checked else false - }, - type: "POST", - dataType: "json", - }) + url: "{% url 'sbas: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); if (data.status == "success") { - toastr.info('Exam state changed.') + toastr.info('Exam state changed.') } // show some message according to the response. // For eg. A message box showing that the status has been changed @@ -77,20 +72,20 @@ }) $("#exam-publish-results-switch").on("change", function () { $.ajax({ - url: "{% url 'sbas: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 'sbas: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); if (data.status == "success") { - toastr.info('Publish results state changed.') + toastr.info('Publish results state changed.') } // show some message according to the response. // For eg. A message box showing that the status has been changed