numerous improvements

This commit is contained in:
Ross
2020-12-05 16:04:36 +00:00
parent 2532d16c52
commit 45e038ccd6
9 changed files with 151 additions and 39 deletions
+13
View File
@@ -0,0 +1,13 @@
{% extends 'anatomy/base.html' %}
{% block content %}
<div class="anatomy">
<h2>CID: {{ cid }}</h2>
The following exams have been found (click to view answers and scores):
<ul>
{% for exam in exams %}
<li><a href="{% url 'anatomy:exam_scores_cid_user' pk=exam.pk sk=cid %}">{{exam.name}}</a></li>
{% endfor %}
</ul>
</div>
{% endblock %}
@@ -6,6 +6,10 @@
<div class="anatomy">
<h1>Exam: {{ exam.name }}</h1>
This exam has {{question_number}} questions.
<div title="Click to enable / disable the exam">
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}>
</div>
<p><button><a href="{% url 'anatomy:mark_overview' pk=exam.pk %}">Mark exam</a></button></p>
<!--<p><button><a href="{% url 'anatomy:exam_take' pk=exam.pk sk=0 %}">Click here to start</a></button></p>-->
@@ -22,4 +26,29 @@ Exams: {{ question.GetExams }} / Modality: {{ question.modality }}
<a href="{% url 'anatomy:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
</div>
<script type="text/javascript">
$(document).ready(function() {
// send request to change the is_private state on customSwitches toggle
$("#exam-active-switch").on("change", function() {
$.ajax({
url: "{% url 'anatomy: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);
// show some message according to the response.
// For eg. A message box showing that the status has been changed
})
.always(function() {
console.log('[Done]');
})
})
});
</script>
{% endblock %}
@@ -1,4 +1,4 @@
{% extends 'anatomy/exams.html' %}
{% extends 'anatomy/base.html' %}
{% block content %}
<div class="anatomy">
+7 -3
View File
@@ -3,11 +3,15 @@
{% block content %}
<div class="anatomy">
<h2>Marking exam: {{ exam.name }}</h2>
Question order will be different on the test system (as it is randomly generated)
Question order may be different on the test system (as json order is not guaranteed to be maintained)
<ul>
<div>
<button class="show-all-button">Show all</button><button class="show-unmarked-button">Show unmarked</button>
</div>
<ul id="question-mark-list">
{% for question in questions.all %}
<li><a href="{% url 'anatomy:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter }}:
<li data-markcount={{question.GetUnmarkedAnswerCount}}><a href="{% url 'anatomy:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter }}:
{{ question }}</a><br /> {{ question.GetUnmarkedAnswersString }}</li>
{% endfor %}
</ul>