This commit is contained in:
Ross
2021-08-17 18:13:25 +01:00
parent afaae40e48
commit 1bcfa722af
+58 -56
View File
@@ -15,8 +15,8 @@
class="help-text">[When checked the exam will be available to take in the test system]</span>
</div>
<div class="parent-help" title="Click to enable / disable the exam results">
Publish results: <input type="checkbox" id="exam-publish-results-switch"
{% if exam.publish_results %}checked{% endif %}> <span class="help-text">[When checked the exam results will
Publish results: <input type="checkbox" id="exam-publish-results-switch" {% if exam.publish_results %}checked{%
endif %}> <span class="help-text">[When checked the exam results will
be available on this site]</span>
</div>
{% endif %}
@@ -26,11 +26,21 @@
{% for question in questions.all %}
<li data-question_pk={{question.pk}}>
Description: {{ question.description}}
<br />
History: {{ question.history}}
<br />
{% for series in question.series.all %}
<span>
Description: {{ question.description}}
<br />
History: {{ question.history}}
<br />
{% for series in question.series.all %}
<div>
Author(s): {{question.get_authors}}
</div>
<div>
<a href="{% url 'longs:exam_question_detail' exam.id forloop.counter0 %}"
title="View the question">View</a> / <a href="{% url 'longs:long_update' question.id %}"
title="Edit the question">Edit</a>
</div>
</span>
<div class="series-block">
Series {{forloop.counter }}:<br />
{{series.get_block}}
@@ -38,14 +48,6 @@
{% empty %}
No series
{% endfor %}
<div>
Author(s): {{question.get_authors}}
</div>
<div>
<a href="{% url 'longs:exam_question_detail' exam.id forloop.counter0 %}"
title="View the question">View</a> / <a href="{% url 'longs:long_update' question.id %}"
title="Edit the question">Edit</a>
</div>
</li>
{% endfor %}
</ol>
@@ -63,7 +65,7 @@
<a href="{% url 'longs:exam_json' pk=exam.pk %}">JSON</a>
<a href="{% url 'longs:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
<a href="{% url 'longs:refresh_exam_question_json' pk=exam.pk %}">Refresh Question JSON cache</a>
<button id='button-open-access'>Make questions open access</button>
<button id='button-closed-access'>Make questions closed access</button>
@@ -73,14 +75,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);
@@ -97,14 +99,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);
@@ -121,14 +123,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);
@@ -143,14 +145,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);
@@ -173,14 +175,14 @@
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",
})
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);