.
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% if exam.exam_mode %}
|
{% if exam.exam_mode %}
|
||||||
<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"
|
Publish results: <input type="checkbox" id="exam-publish-results-switch" data-posturl="{% url 'rapids:exam_toggle_results_published' pk=exam.pk %}"
|
||||||
{% if exam.publish_results %}checked{% endif %}> <span class="help-text">[When checked the exam results will
|
{% if exam.publish_results %}checked{% endif %}> <span class="help-text">[When checked the exam results will
|
||||||
be available on this site]</span>
|
be available on this site]</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
{{ author }},
|
{{ author }},
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<p><button id='button-edit-order' title='click and drag questions to change order'>Edit question order / Delete questions</button></p>
|
<p><button id='button-edit-order' title='click and drag questions to change order' data-posturl="{% url 'rapids:exam_json_edit' pk=exam.pk %}">Edit question order / Delete questions</button></p>
|
||||||
<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}}
|
||||||
@@ -80,17 +80,16 @@
|
|||||||
<a href="{% url 'rapids:exam_json' pk=exam.pk %}">JSON</a>
|
<a href="{% url 'rapids:exam_json' pk=exam.pk %}">JSON</a>
|
||||||
<a href="{% url 'rapids:exam_json_unbased' pk=exam.pk %}">JSON (unbased)</a>
|
<a href="{% url 'rapids:exam_json_unbased' pk=exam.pk %}">JSON (unbased)</a>
|
||||||
<a href="{% url 'rapids:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
|
<a href="{% url 'rapids:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
|
||||||
<button id='button-open-access'>Make questions open access</button>
|
<button id='button-open-access' data-posturl="{% url 'rapids:exam_json_edit' pk=exam.pk %}">Make questions open access</button>
|
||||||
<button id='button-closed-access'>Make questions closed access</button>
|
<button id='button-closed-access' data-posturl="{% url 'rapids:exam_json_edit' pk=exam.pk %}">Make questions closed access</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
// 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 (el) {
|
$("#exam-active-switch").on("change", function (evt) {
|
||||||
console.log(el)
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'rapids:exam_toggle_active' pk=exam.pk %}",
|
url: evt.currentTarget.dataset.posturl,
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
active: this.checked // true if checked else false
|
active: this.checked // true if checked else false
|
||||||
@@ -112,9 +111,9 @@
|
|||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
$("#exam-publish-results-switch").on("change", function () {
|
$("#exam-publish-results-switch").on("change", function (evt) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'rapids:exam_toggle_results_published' pk=exam.pk %}",
|
url: evt.currentTarget.dataset.posturl,
|
||||||
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
|
||||||
@@ -136,9 +135,9 @@
|
|||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
$("#button-open-access").click(function () {
|
$("#button-open-access").click(function (evt) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
url: evt.currentTarget.dataset.posturl,
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
set_open_access: true,
|
set_open_access: true,
|
||||||
@@ -164,9 +163,9 @@
|
|||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
$("#button-closed-access").click(function () {
|
$("#button-closed-access").click(function (evt) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
url: evt.currentTarget.dataset.posturl,
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
set_open_access: false,
|
set_open_access: false,
|
||||||
@@ -192,7 +191,7 @@
|
|||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
$("#button-edit-order").click(function () {
|
$("#button-edit-order").click(function (evt) {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
sortable('.sortable');
|
sortable('.sortable');
|
||||||
|
|
||||||
@@ -204,7 +203,7 @@
|
|||||||
new_order.push(el.dataset.question_pk)
|
new_order.push(el.dataset.question_pk)
|
||||||
})
|
})
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
url: evt.currentTarget.dataset.posturl,
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
set_exam_order: JSON.stringify(new_order),
|
set_exam_order: JSON.stringify(new_order),
|
||||||
|
|||||||
Reference in New Issue
Block a user