Improve answers display on question pages

This commit is contained in:
Ross
2023-02-27 10:02:03 +00:00
parent b14b1c20bd
commit 732ba1b25b
4 changed files with 225 additions and 194 deletions
+18 -2
View File
@@ -40,9 +40,25 @@
</div> </div>
<h1>{{ question.get_primary_answer }}</h1> <h1>{{ question.get_primary_answer }}</h1>
<h2>{{question.question_type}}</h2> <h2>{{question.question_type}}</h2>
Answers (score): {% for answer in question.answers.all %} <details>
{{ answer }} ({{answer.status}}), <summary>
Answers:
</summary>
<table>
<tr><th>Answer</th><th>Score</th></tr>
{% for answer in question.answers.all|dictsortreversed:"status" %}
<tr>
<td>
<span {% if answer.proposed %}class="proposed-answer" data-aid="{{answer.pk}}" data-question-type="anatomy"
{% endif %}>
{{ answer }}
</span>
<td>
<td>{{answer.status}}</td>
</tr>
{% endfor %} {% endfor %}
</table>
</details>
<div> <div>
Description: {{ question.description }} Description: {{ question.description }}
</div> </div>
@@ -14,7 +14,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h2>Edit User / {{ciduser.cid}}</h2> <h2>Edit User / {{ciduser.cid}}</h2>
Use this form to create a user. Only existing supervisors can be added (create it first or add it later if it does not exist). Use this form to create a user. Only existing supervisors can be added (<a href="{% url 'generic:supervisor_create' %}">create them first</a> and refresh this page or add them later if they do not exist).
{% if errors %} {% if errors %}
<div class="alert alert-info" role="alert">{{errors}}</a></div> <div class="alert alert-info" role="alert">{{errors}}</a></div>
{% endif %} {% endif %}
+2
View File
@@ -556,11 +556,13 @@ class UserListTableView(CidManagerRequiredMixin, SingleTableMixin, FilterView):
# context["cid_user_groups"] = cid_user_groups # context["cid_user_groups"] = cid_user_groups
return context return context
class DeleteUserView(CidManagerRequiredMixin, DeleteView): class DeleteUserView(CidManagerRequiredMixin, DeleteView):
model = User model = User
template_name: str = "confirm_delete.html" template_name: str = "confirm_delete.html"
success_url = reverse_lazy("accounts_list") success_url = reverse_lazy("accounts_list")
class UpdateUserView(CidManagerRequiredMixin, UpdateView): class UpdateUserView(CidManagerRequiredMixin, UpdateView):
model = User model = User
fields = ["first_name", "last_name", "email"] # Keep listing whatever fields fields = ["first_name", "last_name", "email"] # Keep listing whatever fields
@@ -49,12 +49,25 @@
{% comment %} <p><b>Scrapped:</b> {{ question.scrapped }} <a {% comment %} <p><b>Scrapped:</b> {{ question.scrapped }} <a
href="{% url 'rapids:rapid_scrap' pk=question.pk %}">(toggle)</a></p> {% endcomment %} href="{% url 'rapids:rapid_scrap' pk=question.pk %}">(toggle)</a></p> {% endcomment %}
<p class="pre-whitespace"> <p class="pre-whitespace">
Answers (score): {% for answer in question.answers.all %} <details>
<summary>
Answers:
</summary>
<table>
<tr><th>Answer</th><th>Score</th></tr>
{% for answer in question.answers.all|dictsortreversed:"status" %}
<tr>
<td>
<span {% if answer.proposed %}class="proposed-answer" data-aid="{{answer.pk}}" data-question-type="rapid" <span {% if answer.proposed %}class="proposed-answer" data-aid="{{answer.pk}}" data-question-type="rapid"
{% endif %}> {% endif %}>
{{ answer }} ({{answer.status}}), {{ answer }}
</span> </span>
<td>
<td>{{answer.status}}</td>
</tr>
{% endfor %} {% endfor %}
</table>
</details>
</p> </p>
</div> </div>
<div> <div>
@@ -96,7 +109,7 @@
</span> </span>
{% endfor %} {% endfor %}
</details> </details>
<a href="{% url 'rapids:question_anonymise_dicom' pk=question.pk %}" <a href="{% url 'rapids:question_anonymise_dicom' pk=question.pk %}"
title="Anonymise dicom images">Anonymise dicoms</a><br /> title="Anonymise dicom images">Anonymise dicoms</a><br />
<script> <script>
$(document).ready(function () { $(document).ready(function () {