.
This commit is contained in:
@@ -50,3 +50,44 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block js %}
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
$(".view-question-link").on("click", function (e) {
|
||||||
|
console.log("click", e)
|
||||||
|
question_number = e.currentTarget.dataset.qn;
|
||||||
|
$("#single-dicom-viewer").empty();
|
||||||
|
$.ajax({
|
||||||
|
url: `{% url 'rapids:question_review' pk=exam.pk %}`,
|
||||||
|
data: {
|
||||||
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
|
question_number: question_number
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
})
|
||||||
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
|
.done(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
let event = new CustomEvent('loadDicomViewerUrls', {
|
||||||
|
"detail": {"images" : data.images, "annotations" : data.annotations}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.dispatchEvent(event);
|
||||||
|
$(".question-display-block .answers").empty().append(data.answers.toString());
|
||||||
|
n = parseInt(question_number) + 1
|
||||||
|
$(".question-display-block .question-number").empty().append(n);
|
||||||
|
// show some message according to the response.
|
||||||
|
// For eg. A message box showing that the status has been changed
|
||||||
|
})
|
||||||
|
.always(function () {
|
||||||
|
console.log('[Done]');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
$(".view-question-link").first().click();
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user