69 lines
2.4 KiB
HTML
69 lines
2.4 KiB
HTML
{% extends 'physics/base.html' %}
|
|
|
|
{% block content %}
|
|
{% load static %}
|
|
<div class="question">
|
|
<a href="{% url 'admin:physics_question_change' question.id %}" title="Edit the Question using the admin interface">Admin Edit</a>
|
|
<div class="date">
|
|
Created: {{ question.created_date }}
|
|
</div>
|
|
<h2>{{question.stem}}</h2>
|
|
<div>
|
|
<ol>
|
|
<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>
|
|
</div>
|
|
<div>
|
|
Examinations: {% for exam in question.exams.all %}
|
|
<a href="{% url 'physics:exam_overview' pk=exam.pk %}">{{ exam.name }}</a>
|
|
{% endfor %}
|
|
</div>
|
|
<div>
|
|
Category: {{ question.category }}
|
|
</div>
|
|
|
|
<div>
|
|
Author: {% for user in question.author.all %}
|
|
{{ author }},
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(document).ready(function () {
|
|
|
|
$("#annotation-json-toggle").click(() => { $("#annotation-json-content").toggle() });
|
|
|
|
// send request to change the is_private state on customSwitches toggle
|
|
$("#save-annotations").click(function () {
|
|
json = getJsonToolStateNoId();
|
|
$.ajax({
|
|
url: "{% url 'anatomy:question_save_annotation' pk=question.pk %}",
|
|
data: {
|
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
|
annotation: json,
|
|
},
|
|
type: "POST",
|
|
dataType: "json",
|
|
})
|
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
|
.done(function (data) {
|
|
console.log(data);
|
|
// show some message according to the response.
|
|
// For eg. A message box showing that the status has been changed
|
|
if (data.status == "success") {
|
|
toastr.info('Annotations saved')
|
|
} else {
|
|
toastr.warning('Error saving annotations')
|
|
}
|
|
})
|
|
.always(function () {
|
|
console.log('[Done]');
|
|
})
|
|
})
|
|
});
|
|
</script>
|
|
{% endblock %} |