.
This commit is contained in:
@@ -2,198 +2,203 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% load thumbnail %}
|
||||
<div class="anatomy">
|
||||
<a href="{% url 'anatomy:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
||||
<a href="{% url 'anatomy:exam_delete' exam.id %}" title="Delete the Exam">Delete</a>
|
||||
<a href="{% url 'admin:anatomy_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin Edit</a>
|
||||
<h1>Exam: {{ exam.name }}</h1>
|
||||
{% load thumbnail %}
|
||||
<div class="anatomy">
|
||||
<a href="{% url 'anatomy:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
||||
<a href="{% url 'anatomy:exam_delete' exam.id %}" title="Delete the Exam">Delete</a>
|
||||
{% if can_edit %}
|
||||
<a href="{% url 'anatomy:exam_clone' exam.id %}" title="Clone the Exam">Delete</a>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
<a href="{% url 'admin:anatomy_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin Edit</a>
|
||||
{% endif %}
|
||||
<h1>Exam: {{ exam.name }}</h1>
|
||||
|
||||
{% include 'exam_notes.html' %}
|
||||
{% include 'exam_notes.html' %}
|
||||
|
||||
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.
|
||||
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.
|
||||
|
||||
Exam mode: {{ exam.exam_mode }}
|
||||
|
||||
{% if exam.exam_mode %}
|
||||
<div class="parent-help" title="Click to enable / disable the exam">
|
||||
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span 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 be available to users on this site]</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
<p><a href="{% url 'anatomy:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
||||
|
||||
<ol id="full-question-list" class="sortable">
|
||||
{% for question in questions.all %}
|
||||
|
||||
<li data-question_pk={{question.pk}}>
|
||||
<a href="{% url 'anatomy:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
|
||||
<img src="{{ question.image|thumbnail_url:'exam-list' }}" alt="thumbail" />
|
||||
</a>
|
||||
{{ question.description }}
|
||||
<br />
|
||||
{{ question.question_type }}: {{ question.get_primary_answer }}
|
||||
<br />
|
||||
Modality: {{ question.modality }}, <a href="{% url 'anatomy:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
|
||||
<span class="id"><a href="{% url 'anatomy:question_detail' pk=question.pk %}">[id: {{question.pk}}]</a></span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<div>
|
||||
Author: {% for author in exam.author.all %}
|
||||
{{ author }},
|
||||
{% endfor %}
|
||||
</div>
|
||||
<p><button id='button-edit-order'>Edit exam order</button></p>
|
||||
<div>
|
||||
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
|
||||
JSON creation id: {{exam.exam_json_id}}
|
||||
</div>
|
||||
<a href="{% url 'anatomy:exam_json' pk=exam.pk %}">JSON</a>
|
||||
<a href="{% url 'anatomy:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
|
||||
<button id='button-open-access'>Make questions open access</button>
|
||||
<button id='button-closed-access'>Make questions closed access</button>
|
||||
|
||||
Exam mode: {{ exam.exam_mode }}
|
||||
|
||||
{% if exam.exam_mode %}
|
||||
<div class="parent-help" title="Click to enable / disable the exam">
|
||||
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span 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 be available to users on this site]</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
<p><a href="{% url 'anatomy:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
||||
|
||||
<ol id="full-question-list" class="sortable">
|
||||
{% for question in questions.all %}
|
||||
|
||||
<li data-question_pk={{question.pk}}>
|
||||
<a href="{% url 'anatomy:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
|
||||
<img src="{{ question.image|thumbnail_url:'exam-list' }}" alt="thumbail" />
|
||||
</a>
|
||||
{{ question.description }}
|
||||
<br />
|
||||
{{ question.question_type }}: {{ question.get_primary_answer }}
|
||||
<br />
|
||||
Modality: {{ question.modality }}, <a href="{% url 'anatomy:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
|
||||
<span class="id"><a href="{% url 'anatomy:question_detail' pk=question.pk %}">[id: {{question.pk}}]</a></span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<div>
|
||||
Author: {% for author in exam.author.all %}
|
||||
{{ author }},
|
||||
{% endfor %}
|
||||
</div>
|
||||
<p><button id='button-edit-order'>Edit exam order</button></p>
|
||||
<div>
|
||||
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
|
||||
JSON creation id: {{exam.exam_json_id}}
|
||||
</div>
|
||||
<a href="{% url 'anatomy:exam_json' pk=exam.pk %}">JSON</a>
|
||||
<a href="{% url 'anatomy:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
|
||||
<button id='button-open-access'>Make questions open access</button>
|
||||
<button id='button-closed-access'>Make questions closed access</button>
|
||||
|
||||
</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",
|
||||
})
|
||||
<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) {
|
||||
.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.
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
})
|
||||
.always(function () {
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
})
|
||||
$("#exam-publish-results-switch").on("change", function () {
|
||||
$.ajax({
|
||||
url: "{% url 'anatomy:exam_toggle_results_published' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
publish_results: this.checked // true if checked else false
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
$("#exam-publish-results-switch").on("change", function () {
|
||||
$.ajax({
|
||||
url: "{% url 'anatomy: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) {
|
||||
.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.
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
})
|
||||
.always(function () {
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
})
|
||||
$("#button-open-access").click(function () {
|
||||
$.ajax({
|
||||
url: "{% url 'generic:generic_exam_json_edit' %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
set_open_access: true,
|
||||
type: "anatomy",
|
||||
exam_id: "{{exam.pk}}",
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
$("#button-open-access").click(function () {
|
||||
$.ajax({
|
||||
url: "{% url 'generic:generic_exam_json_edit' %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
set_open_access: true,
|
||||
type: "anatomy",
|
||||
exam_id: "{{exam.pk}}",
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Question access state changed.')
|
||||
toastr.info('Question access state changed.')
|
||||
}
|
||||
})
|
||||
.fail((e) => {
|
||||
toastr.warning(`Error, ${e}`);
|
||||
.fail((e) => {
|
||||
toastr.warning(`Error, ${e}`);
|
||||
})
|
||||
.always(function () {
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
})
|
||||
$("#button-closed-access").click(function () {
|
||||
$.ajax({
|
||||
//url: "{% url 'anatomy:exam_json_edit' pk=exam.pk %}",
|
||||
url: "{% url 'generic:generic_exam_json_edit' %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
set_open_access: false,
|
||||
type: "anatomy",
|
||||
exam_id: "{{exam.pk}}",
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
$("#button-closed-access").click(function () {
|
||||
$.ajax({
|
||||
//url: "{% url 'anatomy:exam_json_edit' pk=exam.pk %}",
|
||||
url: "{% url 'generic:generic_exam_json_edit' %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
set_open_access: false,
|
||||
type: "anatomy",
|
||||
exam_id: "{{exam.pk}}",
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Question access state changed.')
|
||||
toastr.info('Question access state changed.')
|
||||
}
|
||||
})
|
||||
.fail((e) => {
|
||||
toastr.warning(`Error, ${e}`);
|
||||
.fail((e) => {
|
||||
toastr.warning(`Error, ${e}`);
|
||||
})
|
||||
.always(function () {
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
})
|
||||
$("#button-edit-order").click(function () {
|
||||
$(this).remove();
|
||||
sortable('.sortable');
|
||||
|
||||
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
|
||||
new_order = [];
|
||||
$("#full-question-list li").each((n, el) => {
|
||||
new_order.push(el.dataset.question_pk)
|
||||
})
|
||||
$.ajax({
|
||||
url: "{% url 'anatomy: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);
|
||||
$("#button-edit-order").click(function () {
|
||||
$(this).remove();
|
||||
sortable('.sortable');
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Exam order changed.')
|
||||
}
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
}));
|
||||
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
|
||||
new_order = [];
|
||||
$("#full-question-list li").each((n, el) => {
|
||||
new_order.push(el.dataset.question_pk)
|
||||
})
|
||||
$.ajax({
|
||||
url: "{% url 'anatomy: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);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Exam order changed.')
|
||||
}
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
}));
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
<div class="longs">
|
||||
<a href="{% url 'longs:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
||||
<a href="{% url 'longs:exam_delete' exam.id %}" title="Delete the Exam">Delete</a>
|
||||
{% if can_edit %}
|
||||
<a href="{% url 'longs:exam_clone' exam.id %}" title="Clone the Exam">Delete</a>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
<a href="{% url 'admin:longs_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin Edit</a>
|
||||
{% endif %}
|
||||
|
||||
@@ -2,88 +2,93 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% load thumbnail %}
|
||||
<div class="rapids">
|
||||
<a href="{% url 'rapids:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
||||
<a href="{% url 'rapids:exam_delete' exam.id %}" title="Delete the Exam">Delete</a>
|
||||
<a href="{% url 'admin:rapids_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin
|
||||
Edit</a>
|
||||
<h1>Exam: {{ exam.name }}</h1>
|
||||
{% load thumbnail %}
|
||||
<div class="rapids">
|
||||
<a href="{% url 'rapids:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
||||
<a href="{% url 'rapids:exam_delete' exam.id %}" title="Delete the Exam">Delete</a>
|
||||
{% if can_edit %}
|
||||
<a href="{% url 'rapids:exam_clone' exam.id %}" title="Clone the Exam">Delete</a>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
<a href="{% url 'admin:rapids_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin
|
||||
Edit</a>
|
||||
{% endif %}
|
||||
<h1>Exam: {{ exam.name }}</h1>
|
||||
|
||||
{% include 'exam_notes.html' %}
|
||||
{% include 'exam_notes.html' %}
|
||||
|
||||
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br />
|
||||
<div class="parent-help" title="">
|
||||
Normal count: {{ exam.get_normal_abnormal_breakdown }}<span class="help-text">[Number of normal questions within
|
||||
the exam]</span>
|
||||
</div>
|
||||
<div class="parent-help" title="">
|
||||
Exam mode: {{ exam.exam_mode }}<span class="help-text">[When true the packet will be taken as an exam (it will
|
||||
not self mark and results will be saved here)]</span>
|
||||
</div>
|
||||
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br />
|
||||
<div class="parent-help" title="">
|
||||
Normal count: {{ exam.get_normal_abnormal_breakdown }}<span class="help-text">[Number of normal questions within
|
||||
the exam]</span>
|
||||
</div>
|
||||
<div class="parent-help" title="">
|
||||
Exam mode: {{ exam.exam_mode }}<span class="help-text">[When true the packet will be taken as an exam (it will
|
||||
not self mark and results will be saved here)]</span>
|
||||
</div>
|
||||
|
||||
<div class="parent-help" title="Click to enable / disable the exam">
|
||||
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span
|
||||
class="help-text">[When checked the exam will be available to take in the test system]</span>
|
||||
</div>
|
||||
{% if exam.exam_mode %}
|
||||
<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>
|
||||
</div>
|
||||
{% endif %}
|
||||
<p><a href="{% url 'rapids:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
||||
<div class="parent-help" title="Click to enable / disable the exam">
|
||||
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span
|
||||
class="help-text">[When checked the exam will be available to take in the test system]</span>
|
||||
</div>
|
||||
{% if exam.exam_mode %}
|
||||
<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>
|
||||
</div>
|
||||
{% endif %}
|
||||
<p><a href="{% url 'rapids:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
||||
|
||||
<ol id="full-question-list" class="sortable">
|
||||
{% for question in questions.all %}
|
||||
<ol id="full-question-list" class="sortable">
|
||||
{% for question in questions.all %}
|
||||
|
||||
<li data-question_pk={{question.pk}}>
|
||||
<span class="flex-col">
|
||||
<a href="{% url 'rapids:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
|
||||
{% for image in question.get_images %}
|
||||
<img src="{{ image|thumbnail_url:'exam-list' }}" alt="thumbail" />
|
||||
{% endfor %}
|
||||
</a>
|
||||
</span>
|
||||
<span class="flex-col-4">
|
||||
{% if not question.normal %}
|
||||
<b>Abnormality:</b> {{ question.get_abnormalities }} <b>Region:</b> {{ question.get_regions }}
|
||||
<br />
|
||||
{{ question.get_primary_answer }}
|
||||
{% else %}
|
||||
<b>Normal</b>
|
||||
{% endif %}
|
||||
<br />
|
||||
Examination: {{ question.get_examinations }}, <a
|
||||
href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
|
||||
<span class="id"><a href="{% url 'rapids:question_detail' pk=question.pk %}">[id: {{question.pk}}]</a></span>
|
||||
</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<div>
|
||||
Author: {% for author in exam.author.all %}
|
||||
{{ author }},
|
||||
{% endfor %}
|
||||
</div>
|
||||
<p><button id='button-edit-order' title='click and drag questions to change order'>Edit exam order</button></p>
|
||||
<div>
|
||||
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
|
||||
JSON creation id: {{exam.exam_json_id}}
|
||||
</div>
|
||||
<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_recreate' pk=exam.pk %}">Refresh JSON cache</a>
|
||||
<button id='button-open-access'>Make questions open access</button>
|
||||
<button id='button-closed-access'>Make questions closed access</button>
|
||||
<li data-question_pk={{question.pk}}>
|
||||
<span class="flex-col">
|
||||
<a href="{% url 'rapids:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
|
||||
{% for image in question.get_images %}
|
||||
<img src="{{ image|thumbnail_url:'exam-list' }}" alt="thumbail" />
|
||||
{% endfor %}
|
||||
</a>
|
||||
</span>
|
||||
<span class="flex-col-4">
|
||||
{% if not question.normal %}
|
||||
<b>Abnormality:</b> {{ question.get_abnormalities }} <b>Region:</b> {{ question.get_regions }}
|
||||
<br />
|
||||
{{ question.get_primary_answer }}
|
||||
{% else %}
|
||||
<b>Normal</b>
|
||||
{% endif %}
|
||||
<br />
|
||||
Examination: {{ question.get_examinations }}, <a
|
||||
href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
|
||||
<span class="id"><a href="{% url 'rapids:question_detail' pk=question.pk %}">[id: {{question.pk}}]</a></span>
|
||||
</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<div>
|
||||
Author: {% for author in exam.author.all %}
|
||||
{{ author }},
|
||||
{% endfor %}
|
||||
</div>
|
||||
<p><button id='button-edit-order' title='click and drag questions to change order'>Edit exam order</button></p>
|
||||
<div>
|
||||
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
|
||||
JSON creation id: {{exam.exam_json_id}}
|
||||
</div>
|
||||
<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_recreate' pk=exam.pk %}">Refresh JSON cache</a>
|
||||
<button id='button-open-access'>Make questions open access</button>
|
||||
<button id='button-closed-access'>Make questions closed access</button>
|
||||
|
||||
</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({
|
||||
</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 'rapids:exam_toggle_active' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
@@ -93,21 +98,21 @@
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Exam state changed.')
|
||||
}
|
||||
// show some message according to the response.
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
})
|
||||
.always(function () {
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
})
|
||||
$("#exam-publish-results-switch").on("change", function () {
|
||||
$.ajax({
|
||||
})
|
||||
$("#exam-publish-results-switch").on("change", function () {
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:exam_toggle_results_published' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
@@ -117,21 +122,21 @@
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Publish results state changed.')
|
||||
}
|
||||
// show some message according to the response.
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
})
|
||||
.always(function () {
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
})
|
||||
$("#button-open-access").click(function () {
|
||||
$.ajax({
|
||||
})
|
||||
$("#button-open-access").click(function () {
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
@@ -141,7 +146,7 @@
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
@@ -151,15 +156,15 @@
|
||||
toastr.info(data.status);
|
||||
}
|
||||
})
|
||||
.fail((e) => {
|
||||
.fail((e) => {
|
||||
toastr.warning(`Error, ${e}`);
|
||||
})
|
||||
.always(function () {
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
})
|
||||
$("#button-closed-access").click(function () {
|
||||
$.ajax({
|
||||
})
|
||||
$("#button-closed-access").click(function () {
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
@@ -169,7 +174,7 @@
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
@@ -179,33 +184,33 @@
|
||||
toastr.info(data.status);
|
||||
}
|
||||
})
|
||||
.fail((e) => {
|
||||
.fail((e) => {
|
||||
toastr.warning(`Error, ${e}`);
|
||||
})
|
||||
.always(function () {
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
})
|
||||
$("#button-edit-order").click(function () {
|
||||
$(this).remove();
|
||||
sortable('.sortable');
|
||||
|
||||
$("#full-question-list li").each((n, el) => {
|
||||
$(el).append($(
|
||||
"<span class='exam-question-delete flex-col'><button>DELETE</button></span>"
|
||||
).click(() => {
|
||||
el.remove();
|
||||
}));
|
||||
})
|
||||
$("#button-edit-order").click(function () {
|
||||
$(this).remove();
|
||||
sortable('.sortable');
|
||||
|
||||
$("#full-question-list").append($(
|
||||
"<button title='click and drag questions to change order'>Save exam order</button>"
|
||||
).click(() => {
|
||||
new_order = [];
|
||||
$("#full-question-list li").each((n, el) => {
|
||||
new_order.push(el.dataset.question_pk)
|
||||
$(el).append($(
|
||||
"<span class='exam-question-delete flex-col'><button>DELETE</button></span>"
|
||||
).click(() => {
|
||||
el.remove();
|
||||
}));
|
||||
})
|
||||
$.ajax({
|
||||
|
||||
$("#full-question-list").append($(
|
||||
"<button title='click and drag questions to change order'>Save exam order</button>"
|
||||
).click(() => {
|
||||
new_order = [];
|
||||
$("#full-question-list li").each((n, el) => {
|
||||
new_order.push(el.dataset.question_pk)
|
||||
})
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
@@ -215,20 +220,20 @@
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Exam order changed.')
|
||||
}
|
||||
})
|
||||
.always(function () {
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
}));
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user