.
This commit is contained in:
@@ -2,55 +2,56 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% load thumbnail %}
|
||||
<div class="sbas">
|
||||
<h1>Exam: {{ exam.name }}</h1>
|
||||
{% load thumbnail %}
|
||||
<div class="sbas">
|
||||
<h1>Exam: {{ exam.name }}</h1>
|
||||
|
||||
{% include 'exam_notes.html' %}
|
||||
{% include 'exam_notes.html' %}
|
||||
|
||||
This exam has {{question_number}} questions.
|
||||
<p>This exam has {{question_number}} questions.</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>
|
||||
<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>
|
||||
<!--<p><button><a href="{% url 'anatomy:exam_take' pk=exam.pk sk=0 %}">Click here to start</a></button></p>-->
|
||||
This exam will be available to take <a href="{% url 'sbas:exam_start' pk=exam.pk %}">here</a> (when active).
|
||||
Open access: {{ exam.open_access }}<br />
|
||||
<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 on this site]</span>
|
||||
</div>
|
||||
<!--<p><button><a href="{% url 'anatomy:exam_take' pk=exam.pk sk=0 %}">Click here to start</a></button></p>-->
|
||||
This exam will be available to take <a href="{% url 'sbas:exam_start' pk=exam.pk %}">here</a> (when active).
|
||||
|
||||
{% autoescape off %}
|
||||
<ol id="full-question-list-sba">
|
||||
{% for question in questions.all %}
|
||||
{% autoescape off %}
|
||||
<ol id="full-question-list-sba">
|
||||
{% for question in questions.all %}
|
||||
|
||||
<li>
|
||||
<span>
|
||||
{{ question.stem|safe }}
|
||||
<ol type="a" class="abcde">
|
||||
<li> {{ question.a_answer|safe }} </li>
|
||||
<li> {{ question.b_answer|safe }} </li>
|
||||
<li> {{ question.c_answer|safe }} </li>
|
||||
<li> {{ question.d_answer|safe }} </li>
|
||||
<li> {{ question.e_answer|safe }} </li> Best answer : {{question.best_answer}} ({{question.get_correct_answer_stripped}})
|
||||
<li>
|
||||
<span>
|
||||
{{ question.stem|safe }}
|
||||
<ol type="a" class="abcde">
|
||||
<li> {{ question.a_answer|safe }} </li>
|
||||
<li> {{ question.b_answer|safe }} </li>
|
||||
<li> {{ question.c_answer|safe }} </li>
|
||||
<li> {{ question.d_answer|safe }} </li>
|
||||
<li> {{ question.e_answer|safe }} </li> Best answer : {{question.best_answer}} ({{question.get_correct_answer_stripped}})
|
||||
</ol>
|
||||
</span>
|
||||
Category: {{ question.category }}, <a href="{% url 'sbas:question_detail' pk=question.pk %}">View</a> <a
|
||||
href="{% url 'admin:sbas_question_change' question.id %}">Edit</a>
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</span>
|
||||
Category: {{ question.category }}, <a href="{% url 'sbas:question_detail' pk=question.pk %}">View</a> <a
|
||||
href="{% url 'admin:sbas_question_change' question.id %}">Edit</a>
|
||||
{% endautoescape %}
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endautoescape %}
|
||||
|
||||
</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 'sbas:exam_toggle_active' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
@@ -60,21 +61,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 'sbas:exam_toggle_results_published' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
@@ -84,19 +85,19 @@
|
||||
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]');
|
||||
})
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user