.
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<div class="longs">
|
<div class="longs">
|
||||||
<a href="{% url 'admin:longs_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin Edit</a>
|
<a href="{% url 'admin:longs_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin Edit</a>
|
||||||
<h1>Exam: {{ exam.name }}</h1>
|
<h1>Exam: {{ exam.name }}</h1>
|
||||||
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br/>
|
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br />
|
||||||
Exam mode: {{ exam.exam_mode }}
|
Exam mode: {{ exam.exam_mode }}
|
||||||
|
|
||||||
{% if 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]</span>
|
class="help-text">[When checked the exam will be available to take in the test system]</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="parent-help" title="Click to enable / disable the exam results">
|
<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 be available on this site]</span>
|
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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p><a href="{% url 'longs:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
<p><a href="{% url 'longs:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
||||||
@@ -54,7 +56,7 @@
|
|||||||
<div>
|
<div>
|
||||||
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
|
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
|
||||||
JSON creation id: {{exam.exam_json_id}}
|
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 %}
|
||||||
</div>
|
</div>
|
||||||
<a href="{% url 'longs:exam_json' pk=exam.pk %}">JSON</a>
|
<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:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
|
||||||
@@ -67,14 +69,14 @@
|
|||||||
// send request to change the is_private state on customSwitches toggle
|
// send request to change the is_private state on customSwitches toggle
|
||||||
$("#exam-active-switch").on("change", function () {
|
$("#exam-active-switch").on("change", function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'longs:exam_toggle_active' pk=exam.pk %}",
|
url: "{% url 'longs:exam_toggle_active' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
active: this.checked // true if checked else false
|
active: this.checked // true if checked else false
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
})
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@@ -91,14 +93,14 @@
|
|||||||
})
|
})
|
||||||
$("#exam-publish-results-switch").on("change", function () {
|
$("#exam-publish-results-switch").on("change", function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'longs:exam_toggle_results_published' pk=exam.pk %}",
|
url: "{% url 'longs:exam_toggle_results_published' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
publish_results: this.checked // true if checked else false
|
publish_results: this.checked // true if checked else false
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
})
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@@ -115,14 +117,14 @@
|
|||||||
})
|
})
|
||||||
$("#button-open-access").click(function () {
|
$("#button-open-access").click(function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
set_open_access: true,
|
set_open_access: true,
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
})
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@@ -137,14 +139,14 @@
|
|||||||
})
|
})
|
||||||
$("#button-closed-access").click(function () {
|
$("#button-closed-access").click(function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
set_open_access: false,
|
set_open_access: false,
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
})
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@@ -162,30 +164,30 @@
|
|||||||
sortable('.sortable');
|
sortable('.sortable');
|
||||||
|
|
||||||
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
|
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
|
||||||
new_order = [];
|
new_order = [];
|
||||||
$("#full-question-list li").each((n, el) => {
|
$("#full-question-list li").each((n, el) => {
|
||||||
new_order.push(el.dataset.question_pk)
|
new_order.push(el.dataset.question_pk)
|
||||||
})
|
})
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
url: "{% url 'longs:exam_json_edit' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
set_exam_order: JSON.stringify(new_order),
|
set_exam_order: JSON.stringify(new_order),
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
})
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
if (data.status == "success") {
|
if (data.status == "success") {
|
||||||
toastr.info('Exam order changed.')
|
toastr.info('Exam order changed.')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user