make marking a little nice
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<h2>Marking question {{question_details.current}} of {{question_details.total}}</h2>
|
||||
<a href="{% url 'anatomy:question_detail' question.id %}" title="View the Question">View</a> <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>
|
||||
<h3>{{ question.question_type }}</h3>
|
||||
[{{question.get_primary_answer}}]
|
||||
Primary answer: <span id="primary-answer" title="The primary answer of the question">{{question.get_primary_answer}}</span>
|
||||
|
||||
<div class="marking">
|
||||
<form method="POST" class="post-form">{% csrf_token %}
|
||||
@@ -62,3 +62,81 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
console.log("loads")
|
||||
$(".answer").each(function(n, el) {
|
||||
console.log(n)
|
||||
console.log(el)
|
||||
uri = encodeURI(el.title)
|
||||
button = $(`<a tabindex="0" class='popover-button' role="button" data-toggle="popover" data-trigger="focus" title='${el.title}'>+</a>`)
|
||||
popover = $(`
|
||||
<div id="popover-content-${n}" class="hide popoverdiv">
|
||||
<ul class="popovermenu">
|
||||
<li><a href="https://www.google.com/search?q=${uri}" target="_blank">Google answer</a></li>
|
||||
<span class="copy-to-clipboard" data-text="${el.title}">Copy to clipboard</span>
|
||||
</ul>
|
||||
</div>`)
|
||||
$(el).before(popover)
|
||||
$(el).before(button)
|
||||
|
||||
|
||||
// This is horrible
|
||||
$(button).popover({
|
||||
html: true,
|
||||
trigger: "focus",
|
||||
content: function () {
|
||||
return $(`#popover-content-${n}`).html();
|
||||
}
|
||||
}).on('shown.bs.popover', function(e, n
|
||||
) {
|
||||
text = el.title
|
||||
$(`.copy-to-clipboard`).on("click", function(e) {
|
||||
navigator.clipboard.writeText(text);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
)
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
#primary-answer {
|
||||
font-weight: strong;
|
||||
color: white;
|
||||
}
|
||||
.popover-button {
|
||||
padding-right: 5px;
|
||||
cursor: help;
|
||||
text-decoration: none;
|
||||
color: purple;
|
||||
}
|
||||
.popover, .popover-header {
|
||||
}
|
||||
|
||||
.popovermenu {
|
||||
list-style: none;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
.popovermenu li {
|
||||
}
|
||||
.popovermenu li a {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.answer-list{
|
||||
list-style: none;
|
||||
padding-left: 0px;
|
||||
|
||||
}
|
||||
</style>
|
||||
{% endblock css %}
|
||||
@@ -13,6 +13,7 @@ from .models import (
|
||||
NoteType,
|
||||
CidUser,
|
||||
CidUserExam,
|
||||
ExamUserStatus,
|
||||
UserGrades,
|
||||
UserProfile,
|
||||
Supervisor,
|
||||
@@ -31,6 +32,7 @@ admin.site.register(QuestionNote)
|
||||
admin.site.register(NoteType)
|
||||
admin.site.register(CidUser)
|
||||
admin.site.register(CidUserExam)
|
||||
admin.site.register(ExamUserStatus)
|
||||
admin.site.register(CidUserGroup)
|
||||
admin.site.register(UserProfile)
|
||||
admin.site.register(UserGrades)
|
||||
|
||||
+4
-1
@@ -919,11 +919,14 @@ class ExamUserStatus(models.Model):
|
||||
exam = GenericForeignKey("content_type", "object_id")
|
||||
|
||||
def __str__(self):
|
||||
self.cid_user: "CidUser"
|
||||
if self.cid_user:
|
||||
user = self.cid_user.cid
|
||||
email = self.cid_user.email_field
|
||||
return f"{self.datetime}: {user} () - {self.status} ({self.extra})"
|
||||
else:
|
||||
user = self.user_user.username
|
||||
return f"{self.datetime}: {user} - {self.status} ({self.extra})"
|
||||
return f"{self.datetime}: {user} - {self.status} ({self.extra})"
|
||||
|
||||
|
||||
class UserAnswerBase(models.Model):
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<h3>This question is abnormal</h3>
|
||||
Answers given as normal will be automatically marked.<br />
|
||||
Region: {{ question.get_regions }}, Abnormalities: {{ question.get_abnormalities }}<br />
|
||||
[{{question.get_primary_answer}}]
|
||||
Primary answer: <span id="primary-answer" title="The primary answer of the question">{{question.get_primary_answer}}</span>
|
||||
{% endif %}
|
||||
<div class="marking">
|
||||
<form method="POST" class="post-form">{% csrf_token %}
|
||||
@@ -146,3 +146,12 @@
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
#primary-answer {
|
||||
font-weight: strong;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
{% endblock css %}
|
||||
Reference in New Issue
Block a user