.
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% if can_edit %}
|
{% if can_edit %}
|
||||||
<p><button id='button-edit-order'>Edit exam order</button></p>
|
<p><button id='button-edit-order'>Edit question order / Delete questions</button></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<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"}}),
|
||||||
|
|||||||
+14
-2
@@ -36,9 +36,9 @@ from longs.models import Exam as LongExam
|
|||||||
from anatomy.models import AnatomyQuestion as AnatomyQuestion
|
from anatomy.models import AnatomyQuestion as AnatomyQuestion
|
||||||
from anatomy.models import Exam as AnatomyExam
|
from anatomy.models import Exam as AnatomyExam
|
||||||
from sbas.models import Question as SbasQuestion
|
from sbas.models import Question as SbasQuestion
|
||||||
#from sbas.models import Exam as SbasExam
|
from sbas.models import Exam as SbasExam
|
||||||
from physics.models import Question as PhysicsQuestion
|
from physics.models import Question as PhysicsQuestion
|
||||||
#from physics.models import Exam as PhysicsExam
|
from physics.models import Exam as PhysicsExam
|
||||||
|
|
||||||
from django.db.models import Case, When
|
from django.db.models import Case, When
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -109,6 +109,12 @@ def generic_exam_json_edit(request):
|
|||||||
elif question_type == "anatomy":
|
elif question_type == "anatomy":
|
||||||
Exam = AnatomyExam
|
Exam = AnatomyExam
|
||||||
Question = AnatomyQuestion
|
Question = AnatomyQuestion
|
||||||
|
elif question_type == "physics":
|
||||||
|
Exam = PhysicsExam
|
||||||
|
Question = PhysicsQuestion
|
||||||
|
elif question_type == "sbas":
|
||||||
|
Exam = SbasExam
|
||||||
|
Question = SbasQuestion
|
||||||
else:
|
else:
|
||||||
data = {"status": "error"}
|
data = {"status": "error"}
|
||||||
return JsonResponse(data, status=400)
|
return JsonResponse(data, status=400)
|
||||||
@@ -116,6 +122,12 @@ def generic_exam_json_edit(request):
|
|||||||
|
|
||||||
exam = get_object_or_404(Exam, pk=request.POST.get("exam_id"))
|
exam = get_object_or_404(Exam, pk=request.POST.get("exam_id"))
|
||||||
|
|
||||||
|
#if "exam_toggle_active" in request.POST:
|
||||||
|
# active = json.loads(request.POST.get("active"))
|
||||||
|
|
||||||
|
# data = {"status": "success"}
|
||||||
|
# return JsonResponse(data, status=200)
|
||||||
|
|
||||||
if "add_exam_questions" in request.POST:
|
if "add_exam_questions" in request.POST:
|
||||||
question_ids = json.loads(request.POST.get("add_exam_questions"))
|
question_ids = json.loads(request.POST.get("add_exam_questions"))
|
||||||
#question_objects = Question.objects.filter(pk__in=question_ids)
|
#question_objects = Question.objects.filter(pk__in=question_ids)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
|
|
||||||
{% if can_edit %}
|
{% if can_edit %}
|
||||||
|
|
||||||
<p><button id='button-edit-order'>Edit exam order</button></p>
|
<p><button id='button-edit-order'>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}}
|
||||||
@@ -189,6 +189,14 @@
|
|||||||
$(this).remove();
|
$(this).remove();
|
||||||
sortable('.sortable');
|
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();
|
||||||
|
}));
|
||||||
|
})
|
||||||
|
|
||||||
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
|
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
|
||||||
new_order = [];
|
new_order = [];
|
||||||
$("#full-question-list li").each((n, el) => {
|
$("#full-question-list li").each((n, el) => {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</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 %} data-posturl="{% url 'rapids:exam_toggle_active' pk=exam.pk %}"> <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 %}
|
||||||
@@ -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 exam order</button></p>
|
<p><button id='button-edit-order' title='click and drag questions to change order'>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}}
|
||||||
@@ -87,7 +87,8 @@
|
|||||||
<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 (el) {
|
||||||
|
console.log(el)
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'rapids:exam_toggle_active' pk=exam.pk %}",
|
url: "{% url 'rapids:exam_toggle_active' pk=exam.pk %}",
|
||||||
data: {
|
data: {
|
||||||
@@ -195,14 +196,6 @@
|
|||||||
$(this).remove();
|
$(this).remove();
|
||||||
sortable('.sortable');
|
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();
|
|
||||||
}));
|
|
||||||
})
|
|
||||||
|
|
||||||
$("#full-question-list").append($(
|
$("#full-question-list").append($(
|
||||||
"<button title='click and drag questions to change order'>Save exam order</button>"
|
"<button title='click and drag questions to change order'>Save exam order</button>"
|
||||||
).click(() => {
|
).click(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user