.
This commit is contained in:
@@ -2,198 +2,203 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% load thumbnail %}
|
{% load thumbnail %}
|
||||||
<div class="anatomy">
|
<div class="anatomy">
|
||||||
<a href="{% url 'anatomy:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
<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 '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>
|
{% if can_edit %}
|
||||||
<h1>Exam: {{ exam.name }}</h1>
|
<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>
|
||||||
<div class="parent-help" title="Click to enable / disable the exam results">
|
<script type="text/javascript">
|
||||||
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>
|
$(document).ready(function () {
|
||||||
</div>
|
// send request to change the is_private state on customSwitches toggle
|
||||||
{% endif %}
|
$("#exam-active-switch").on("change", function () {
|
||||||
<p><a href="{% url 'anatomy:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
$.ajax({
|
||||||
|
url: "{% url 'anatomy:exam_toggle_active' pk=exam.pk %}",
|
||||||
<ol id="full-question-list" class="sortable">
|
data: {
|
||||||
{% for question in questions.all %}
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
|
active: this.checked // true if checked else false
|
||||||
<li data-question_pk={{question.pk}}>
|
},
|
||||||
<a href="{% url 'anatomy:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
|
type: "POST",
|
||||||
<img src="{{ question.image|thumbnail_url:'exam-list' }}" alt="thumbail" />
|
dataType: "json",
|
||||||
</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",
|
|
||||||
})
|
|
||||||
// $.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 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
|
// For eg. A message box showing that the status has been changed
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
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
|
// $.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('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
|
// For eg. A message box showing that the status has been changed
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
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
|
// $.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('Question access state changed.')
|
toastr.info('Question access state changed.')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fail((e) => {
|
.fail((e) => {
|
||||||
toastr.warning(`Error, ${e}`);
|
toastr.warning(`Error, ${e}`);
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
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
|
// $.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('Question access state changed.')
|
toastr.info('Question access state changed.')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fail((e) => {
|
.fail((e) => {
|
||||||
toastr.warning(`Error, ${e}`);
|
toastr.warning(`Error, ${e}`);
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
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({
|
$("#button-edit-order").click(function () {
|
||||||
url: "{% url 'anatomy:exam_json_edit' pk=exam.pk %}",
|
$(this).remove();
|
||||||
data: {
|
sortable('.sortable');
|
||||||
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") {
|
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
|
||||||
toastr.info('Exam order changed.')
|
new_order = [];
|
||||||
}
|
$("#full-question-list li").each((n, el) => {
|
||||||
})
|
new_order.push(el.dataset.question_pk)
|
||||||
.always(function () {
|
})
|
||||||
console.log('[Done]');
|
$.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>
|
||||||
</script>
|
{% endblock %}
|
||||||
{% endblock %}
|
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
<div class="longs">
|
<div class="longs">
|
||||||
<a href="{% url 'longs:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
<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>
|
<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 %}
|
{% 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>
|
<a href="{% url 'admin:longs_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin Edit</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -2,88 +2,93 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% load thumbnail %}
|
{% load thumbnail %}
|
||||||
<div class="rapids">
|
<div class="rapids">
|
||||||
<a href="{% url 'rapids:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
<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 '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
|
{% if can_edit %}
|
||||||
Edit</a>
|
<a href="{% url 'rapids:exam_clone' exam.id %}" title="Clone the Exam">Delete</a>
|
||||||
<h1>Exam: {{ exam.name }}</h1>
|
{% 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 />
|
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br />
|
||||||
<div class="parent-help" title="">
|
<div class="parent-help" title="">
|
||||||
Normal count: {{ exam.get_normal_abnormal_breakdown }}<span class="help-text">[Number of normal questions within
|
Normal count: {{ exam.get_normal_abnormal_breakdown }}<span class="help-text">[Number of normal questions within
|
||||||
the exam]</span>
|
the exam]</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="parent-help" title="">
|
<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
|
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>
|
not self mark and results will be saved here)]</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="parent-help" title="Click to enable / disable the exam">
|
<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
|
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>
|
class="help-text">[When checked the exam will be available to take in the test system]</span>
|
||||||
</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"
|
||||||
{% 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>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p><a href="{% url 'rapids:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
<p><a href="{% url 'rapids:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
||||||
|
|
||||||
<ol id="full-question-list" class="sortable">
|
<ol id="full-question-list" class="sortable">
|
||||||
{% for question in questions.all %}
|
{% for question in questions.all %}
|
||||||
|
|
||||||
<li data-question_pk={{question.pk}}>
|
<li data-question_pk={{question.pk}}>
|
||||||
<span class="flex-col">
|
<span class="flex-col">
|
||||||
<a href="{% url 'rapids:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
|
<a href="{% url 'rapids:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
|
||||||
{% for image in question.get_images %}
|
{% for image in question.get_images %}
|
||||||
<img src="{{ image|thumbnail_url:'exam-list' }}" alt="thumbail" />
|
<img src="{{ image|thumbnail_url:'exam-list' }}" alt="thumbail" />
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<span class="flex-col-4">
|
<span class="flex-col-4">
|
||||||
{% if not question.normal %}
|
{% if not question.normal %}
|
||||||
<b>Abnormality:</b> {{ question.get_abnormalities }} <b>Region:</b> {{ question.get_regions }}
|
<b>Abnormality:</b> {{ question.get_abnormalities }} <b>Region:</b> {{ question.get_regions }}
|
||||||
<br />
|
<br />
|
||||||
{{ question.get_primary_answer }}
|
{{ question.get_primary_answer }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<b>Normal</b>
|
<b>Normal</b>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br />
|
<br />
|
||||||
Examination: {{ question.get_examinations }}, <a
|
Examination: {{ question.get_examinations }}, <a
|
||||||
href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</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 class="id"><a href="{% url 'rapids:question_detail' pk=question.pk %}">[id: {{question.pk}}]</a></span>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ol>
|
</ol>
|
||||||
<div>
|
<div>
|
||||||
Author: {% for author in exam.author.all %}
|
Author: {% for author in exam.author.all %}
|
||||||
{{ author }},
|
{{ author }},
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<p><button id='button-edit-order' title='click and drag questions to change order'>Edit exam order</button></p>
|
<p><button id='button-edit-order' title='click and drag questions to change order'>Edit exam order</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}}
|
||||||
</div>
|
</div>
|
||||||
<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'>Make questions open access</button>
|
||||||
<button id='button-closed-access'>Make questions closed access</button>
|
<button id='button-closed-access'>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 () {
|
$("#exam-active-switch").on("change", function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'rapids:exam_toggle_active' pk=exam.pk %}",
|
url: "{% url 'rapids:exam_toggle_active' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
@@ -93,21 +98,21 @@
|
|||||||
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 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
|
// For eg. A message box showing that the status has been changed
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
$("#exam-publish-results-switch").on("change", function () {
|
$("#exam-publish-results-switch").on("change", function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'rapids:exam_toggle_results_published' pk=exam.pk %}",
|
url: "{% url 'rapids:exam_toggle_results_published' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
@@ -117,21 +122,21 @@
|
|||||||
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('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
|
// For eg. A message box showing that the status has been changed
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
$("#button-open-access").click(function () {
|
$("#button-open-access").click(function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
@@ -141,7 +146,7 @@
|
|||||||
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") {
|
||||||
@@ -151,15 +156,15 @@
|
|||||||
toastr.info(data.status);
|
toastr.info(data.status);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fail((e) => {
|
.fail((e) => {
|
||||||
toastr.warning(`Error, ${e}`);
|
toastr.warning(`Error, ${e}`);
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
$("#button-closed-access").click(function () {
|
$("#button-closed-access").click(function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
@@ -169,7 +174,7 @@
|
|||||||
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") {
|
||||||
@@ -179,33 +184,33 @@
|
|||||||
toastr.info(data.status);
|
toastr.info(data.status);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fail((e) => {
|
.fail((e) => {
|
||||||
toastr.warning(`Error, ${e}`);
|
toastr.warning(`Error, ${e}`);
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
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) => {
|
$("#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 %}",
|
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
@@ -215,20 +220,20 @@
|
|||||||
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]');
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user