.
This commit is contained in:
+1
-1
@@ -203,4 +203,4 @@ class BodyPartForm(ModelForm):
|
|||||||
class ExamForm(ModelForm):
|
class ExamForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Exam
|
model = Exam
|
||||||
fields = ["name", "time_limit", "exam_mode", "active", "archive"]
|
fields = ["name", "time_limit", "open_access", "exam_mode", "active", "archive"]
|
||||||
@@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
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 }}
|
Exam mode: {{ exam.exam_mode }}<br />
|
||||||
|
Open access: {{ exam.open_access }}<br />
|
||||||
|
|
||||||
{% if exam.exam_mode %}
|
{% if exam.exam_mode %}
|
||||||
<div class="parent-help" title="Click to enable / disable the exam">
|
<div class="parent-help" title="Click to enable / disable the exam">
|
||||||
|
|||||||
+1
-1
@@ -208,4 +208,4 @@ LongSeriesImageFormSet = inlineformset_factory(
|
|||||||
class ExamForm(ModelForm):
|
class ExamForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Exam
|
model = Exam
|
||||||
fields = ["name", "time_limit", "exam_mode", "active", "double_mark", "archive"]
|
fields = ["name", "time_limit", "open_access", "exam_mode", "active", "double_mark", "archive"]
|
||||||
@@ -17,7 +17,8 @@
|
|||||||
{% 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 />
|
||||||
Exam mode: {{ exam.exam_mode }}
|
Exam mode: {{ exam.exam_mode }}<br />
|
||||||
|
Open access: {{ exam.open_access }}<br />
|
||||||
|
|
||||||
{% if exam.exam_mode %}
|
{% if exam.exam_mode %}
|
||||||
<div class="parent-help" title="Click to enable / disable the exam">
|
<div class="parent-help" title="Click to enable / disable the exam">
|
||||||
|
|||||||
+1
-1
@@ -31,4 +31,4 @@ class CidUserAnswerForm(ModelForm):
|
|||||||
class ExamForm(ModelForm):
|
class ExamForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Exam
|
model = Exam
|
||||||
fields = ["name", "time_limit", "exam_mode", "active"]
|
fields = ["name", "time_limit", "open_access", "exam_mode", "active"]
|
||||||
@@ -2,105 +2,106 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% load thumbnail %}
|
{% load thumbnail %}
|
||||||
<div class="physics">
|
<div class="physics">
|
||||||
<h1>Exam: {{ exam.name }}</h1>
|
<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>
|
||||||
|
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 'physics:exam_take' pk=exam.pk %}">here</a> (when active).
|
||||||
|
|
||||||
|
{% autoescape off %}
|
||||||
|
<ol id="full-question-list-physics">
|
||||||
|
{% for question in questions.all %}
|
||||||
|
|
||||||
|
<li>
|
||||||
|
{{ question.stem }}
|
||||||
|
<ol type="a" class="abcde">
|
||||||
|
<li>
|
||||||
|
{{ question.a }}: {{ question.a_answer }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{{ question.b }}: {{ question.b_answer }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{{ question.c }}: {{ question.c_answer }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{{ question.d }}: {{ question.d_answer }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{{ question.e }}: {{ question.e_answer }}
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
Category: {{ question.category }}, <a href="{% url 'physics:question_detail' pk=question.pk %}">View</a> <a href="{% url 'admin:physics_question_change' question.id %}">Edit</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ol>
|
||||||
|
{% endautoescape %}
|
||||||
|
|
||||||
<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 on this site]</span>
|
$(document).ready(function () {
|
||||||
</div>
|
// send request to change the is_private state on customSwitches toggle
|
||||||
<!--<p><button><a href="{% url 'anatomy:exam_take' pk=exam.pk sk=0 %}">Click here to start</a></button></p>-->
|
$("#exam-active-switch").on("change", function () {
|
||||||
This exam will be available to take <a href="{% url 'physics:exam_take' pk=exam.pk %}">here</a> (when active).
|
$.ajax({
|
||||||
|
url: "{% url 'physics:exam_toggle_active' pk=exam.pk %}",
|
||||||
{% autoescape off %}
|
data: {
|
||||||
<ol id="full-question-list-physics">
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
{% for question in questions.all %}
|
active: this.checked // true if checked else false
|
||||||
|
},
|
||||||
<li>
|
type: "POST",
|
||||||
{{ question.stem }}
|
dataType: "json",
|
||||||
<ol type="a" class="abcde">
|
})
|
||||||
<li>
|
|
||||||
{{ question.a }}: {{ question.a_answer }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
{{ question.b }}: {{ question.b_answer }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
{{ question.c }}: {{ question.c_answer }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
{{ question.d }}: {{ question.d_answer }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
{{ question.e }}: {{ question.e_answer }}
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
Category: {{ question.category }}, <a href="{% url 'physics:question_detail' pk=question.pk %}">View</a> <a href="{% url 'admin:physics_question_change' question.id %}">Edit</a>
|
|
||||||
|
|
||||||
</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({
|
|
||||||
url: "{% url 'physics: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 'physics: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 'physics: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]');
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
+1
-1
@@ -214,4 +214,4 @@ AnswerUpdateFormSet = inlineformset_factory(
|
|||||||
class ExamForm(ModelForm):
|
class ExamForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Exam
|
model = Exam
|
||||||
fields = ["name", "time_limit", "exam_mode", "active", "archive"]
|
fields = ["name", "time_limit", "open_access", "exam_mode", "active", "archive"]
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
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>
|
||||||
|
Open access: {{ exam.open_access }}<br />
|
||||||
|
|
||||||
<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 %} data-posturl="{% url 'rapids:exam_toggle_active' pk=exam.pk %}"> <span
|
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %} data-posturl="{% url 'rapids:exam_toggle_active' pk=exam.pk %}"> <span
|
||||||
|
|||||||
@@ -2,55 +2,56 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% load thumbnail %}
|
{% load thumbnail %}
|
||||||
<div class="sbas">
|
<div class="sbas">
|
||||||
<h1>Exam: {{ exam.name }}</h1>
|
<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">
|
Open access: {{ exam.open_access }}<br />
|
||||||
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span
|
<div class="parent-help" title="Click to enable / disable the exam">
|
||||||
class="help-text">[When checked the exam will be available to take in the test system]</span>
|
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span
|
||||||
</div>
|
class="help-text">[When checked the exam will be available to take in the test system]</span>
|
||||||
<div class="parent-help" title="Click to enable / disable the exam results">
|
</div>
|
||||||
Publish results: <input type="checkbox" id="exam-publish-results-switch"
|
<div class="parent-help" title="Click to enable / disable the exam results">
|
||||||
{% if exam.publish_results %}checked{% endif %}> <span class="help-text">[When checked the exam results will
|
Publish results: <input type="checkbox" id="exam-publish-results-switch"
|
||||||
be available on this site]</span>
|
{% if exam.publish_results %}checked{% endif %}> <span class="help-text">[When checked the exam results will
|
||||||
</div>
|
be available on this site]</span>
|
||||||
<!--<p><button><a href="{% url 'anatomy:exam_take' pk=exam.pk sk=0 %}">Click here to start</a></button></p>-->
|
</div>
|
||||||
This exam will be available to take <a href="{% url 'sbas:exam_start' pk=exam.pk %}">here</a> (when active).
|
<!--<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 %}
|
{% autoescape off %}
|
||||||
<ol id="full-question-list-sba">
|
<ol id="full-question-list-sba">
|
||||||
{% for question in questions.all %}
|
{% for question in questions.all %}
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<span>
|
<span>
|
||||||
{{ question.stem|safe }}
|
{{ question.stem|safe }}
|
||||||
<ol type="a" class="abcde">
|
<ol type="a" class="abcde">
|
||||||
<li> {{ question.a_answer|safe }} </li>
|
<li> {{ question.a_answer|safe }} </li>
|
||||||
<li> {{ question.b_answer|safe }} </li>
|
<li> {{ question.b_answer|safe }} </li>
|
||||||
<li> {{ question.c_answer|safe }} </li>
|
<li> {{ question.c_answer|safe }} </li>
|
||||||
<li> {{ question.d_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> {{ 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>
|
</ol>
|
||||||
</span>
|
{% endautoescape %}
|
||||||
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>
|
</div>
|
||||||
{% endfor %}
|
<script type="text/javascript">
|
||||||
</ol>
|
$(document).ready(function () {
|
||||||
{% endautoescape %}
|
// send request to change the is_private state on customSwitches toggle
|
||||||
|
$("#exam-active-switch").on("change", function () {
|
||||||
</div>
|
$.ajax({
|
||||||
<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 %}",
|
url: "{% url 'sbas:exam_toggle_active' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
@@ -60,21 +61,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 'sbas:exam_toggle_results_published' pk=exam.pk %}",
|
url: "{% url 'sbas:exam_toggle_results_published' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
@@ -84,19 +85,19 @@
|
|||||||
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]');
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user