more fixes

This commit is contained in:
Ross
2020-12-27 11:41:40 +00:00
parent 57b05da029
commit ccf92c0632
5 changed files with 68 additions and 38 deletions
+3 -3
View File
@@ -116,7 +116,6 @@ button a {
}
.marking-list {
float: right;
}
.save {
@@ -147,12 +146,13 @@ button a {
#dicom-image {
width: 60%;
float: left;
position: fixed;
right: 0px;
height: 600px;
bottom: 0px;
}
.marking {
float: right;
}
#question-mark-list {
+1 -1
View File
@@ -3,7 +3,7 @@
{% block content %}
<h2>Marking question {{question_details.current}} of {{question_details.total}}</h2>
<a href="{% url 'anatomy:anatomy_question_update' question.id %}" title="Edit the Question">Edit</a> <a href="{% url 'admin:anatomy_anatomyquestion_change' question.id %}" title="Edit the Question using the admin interface">Admin Edit</a>
<p>{{ question.question_type }}</p>
<h3>{{ question.question_type }}</h3>
<div id="dicom-image" data-url="{{ question.image.url}}" data-annotations='{{question.image_annotations}}'>
</div>
+4
View File
@@ -25,6 +25,10 @@
{% endfor %}
</ul>
<p>Active exams will be available to take at the below url:
<a href="{% url 'physics:active_exams' %}">Available exams</a>
</p>
</div>
{% endblock %}
+50 -33
View File
@@ -5,13 +5,25 @@
<div class="physics">
<h1>Exam: {{ exam.name }}</h1>
<div class="alert alert-info" role="alert">
<h3>Instructions</h3>
<p>
Please make sure you submit answers before closing or navigating from this page (as otherwise they will not
be saved). The submit button is at the bottom of the page.
</p>
<p>
Click on a question to toggle between true / false.
</p>
<p>
Ensure your candidate number is entered in the below box.
</p>
</div>
<div>
Candidate number: <input type="number" id="cid" name="cid" title="please enter your candidate number">
</div>
<p>
Please make sure you submit answers before closing or navigating from this page (as otherwise they will not be
saved)
</p>
<h2>Questions</h2>
{% autoescape off %}
<ol id="full-question-list-physics">
@@ -22,31 +34,36 @@
<ol type="a" class="abcde">
<li>
<span class="question-text">{{ question.a }}:</span> <label class="truefalse-switch"> <input
type="checkbox" class="question a" id="{{question.pk}}-a-checkbox" data-q="{{question.pk}}" data-a="a">
type="checkbox" class="question a" id="{{question.pk}}-a-checkbox" data-q="{{question.pk}}"
data-a="a">
<div class="slider round a"></div>
</label>
</li>
<li>
<span class="question-text">{{ question.b }}:</span> <label class="truefalse-switch"> <input
type="checkbox" class="question b" id="{{question.pk}}-b-checkbox" data-q="{{question.pk}}" data-a="b">
type="checkbox" class="question b" id="{{question.pk}}-b-checkbox" data-q="{{question.pk}}"
data-a="b">
<div class="slider round b"></div>
</label>
</li>
<li>
<span class="question-text">{{ question.c }}:</span> <label class="truefalse-switch"> <input
type="checkbox" class="question c" id="{{question.pk}}-c-checkbox" data-q="{{question.pk}}" data-a="c">
type="checkbox" class="question c" id="{{question.pk}}-c-checkbox" data-q="{{question.pk}}"
data-a="c">
<div class="slider round c"></div>
</label>
</li>
<li>
<span class="question-text">{{ question.d }}:</span> <label class="truefalse-switch"> <input
type="checkbox" class="question d" id="{{question.pk}}-d-checkbox" data-q="{{question.pk}}" data-a="d">
type="checkbox" class="question d" id="{{question.pk}}-d-checkbox" data-q="{{question.pk}}"
data-a="d">
<div class="slider round d"></div>
</label>
</li>
<li>
<span class="question-text">{{ question.e }}:</span> <label class="truefalse-switch"> <input
type="checkbox" class="question e" id="{{question.pk}}-e-checkbox" data-q="{{question.pk}}" data-a="e">
type="checkbox" class="question e" id="{{question.pk}}-e-checkbox" data-q="{{question.pk}}"
data-a="e">
<div class="slider round e"></div>
</label>
</li>
@@ -71,7 +88,7 @@
$(evt.target).parent().find("input").click();
});
$("#submit").click(() =>{
$("#submit").click(() => {
let cid = $("#cid").val()
if (cid == "") {
alert("You need to enter a valid candidate number.");
@@ -106,31 +123,31 @@
}
}
function postAnswers(ans) {
console.log(ans);
$.post("{% url 'physics:exam_answers_submit' %}", JSON.stringify(ans)).done((data) => {
console.log(data);
if (data.success) {
let ret = confirm(
`Answers sucessfully submitted. Click OK to finish the exam.`
);
function postAnswers(ans) {
console.log(ans);
$.post("{% url 'physics:exam_answers_submit' %}", JSON.stringify(ans)).done((data) => {
console.log(data);
if (data.success) {
let ret = confirm(
`Answers sucessfully submitted. Click OK to finish the exam.`
);
if (ret) {
//window.saveSession();
$("#exams-button-link").remove();
$("#submit").after('<button id="exams-button-link">Return to exam list</button>');
$("#exams-button-link").click(() => {
window.location.href = "{% url 'physics:active_exams' %}";
})
window.answers_submitted = true;
} else {
}
} else {
alert(`Error submitting answers: ${data.error}`);
if (ret) {
//window.saveSession();
$("#exams-button-link").remove();
$("#submit").after('<button id="exams-button-link">Return to exam list</button>');
$("#exams-button-link").click(() => {
window.location.href = "{% url 'physics:active_exams' %}";
})
window.answers_submitted = true;
} else {
}
} else {
alert(`Error submitting answers: ${data.error}`);
}
});
// $.post( "http://localhost:8000/submit_answers", JSON.stringify(ans));
}
});
// $.post( "http://localhost:8000/submit_answers", JSON.stringify(ans));
}
</script>
+10 -1
View File
@@ -2,13 +2,22 @@
{% block content %}
<div class="">
<h2>Please enter your CID</h2>
<h2>Score / Results checker</h2>
<p>Please enter your CID</p>
<p>CID: <input type="text" name="cid" id="cid-input"></p>
<button id="cid-selector-go-button">Go...</button>
</div>
<script>
$(document).ready(function () {
$("#cid-input").keypress(function(e) {
// Enter pressed?
console.log(e)
if(e.which == 10 || e.which == 13) {
$("#cid-selector-go-button").click();
}
});
$("#cid-selector-go-button").click(() => {
cid = document.getElementById("cid-input").value;
window.location = window.location + cid;