Add bulk open access management for exam questions in overview template

This commit is contained in:
Ross
2025-10-20 21:35:20 +01:00
parent 9b9cd8c813
commit 6cb1303630
@@ -34,6 +34,8 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if exam.archive %} {% if exam.archive %}
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
This exam is archived. Results and submitted answers will not be available to candidates. They can still be viewed by supervisors. This exam is archived. Results and submitted answers will not be available to candidates. They can still be viewed by supervisors.
@@ -54,6 +56,31 @@ Exam mode: {{ exam.exam_mode }}<br />
{% endif %} {% endif %}
{% endif %} {% endif %}
<div class="mt-3">
<div class="card">
<div class="card-header p-2">
<a class="d-flex justify-content-between align-items-center" data-bs-toggle="collapse" href="#open-access-bulk" role="button" aria-expanded="false" aria-controls="open-access-bulk">
<span>Open access (bulk)</span>
<small class="text-muted">Expand to change selected questions</small>
</a>
</div>
<div class="collapse" id="open-access-bulk">
<div class="card-body">
<form hx-post="{% url 'generic:generic_exam_set_open_access' %}" hx-target="#action-result" hx-swap="innerHTML">
<input type="hidden" name="type" value="sbas" />
<input type="hidden" name="exam_id" value="{{ exam.pk }}" />
<div class="mb-2 small text-muted">Select questions on the list above (checkboxes) then click one of the actions below.</div>
<div class="d-flex gap-2">
<button class="btn btn-sm btn-outline-success" type="submit" name="set_open_access" value="true" hx-include="input[name='selection']:checked">Set Open Access = True</button>
<button class="btn btn-sm btn-outline-danger" type="submit" name="set_open_access" value="false" hx-include="input[name='selection']:checked">Set Open Access = False</button>
<button class="btn btn-sm btn-secondary" type="button" onclick="document.querySelector('#open-access-bulk').classList.remove('show');">Close</button>
</div>
</form>
<div id="action-result" class="mt-2"></div>
</div>
</div>
</div>
</div>
Markers: Markers:
{% for marker in exam.markers.all %} {% for marker in exam.markers.all %}
@@ -99,7 +126,7 @@ Open access: {{ exam.open_access }}<br />
{% include "generic/partials/exams/exam_status.html#exam-active" %} {% include "generic/partials/exams/exam_status.html#exam-active" %}
{% if exam.exam_mode %} {% if exam.exam_mode %}
{% include "generic/partials/exams/exam_status.html#publish-results" %} {% include "generic/partials/exams/exam_status.html#publish-results" %}
{% if exam.get_app_name == "anatomy" or exam.get_app_name == "longs" %} {% if exam.get_app_name == "anatomy" or exam.get_app_name == "longs" %}
<p><a href="{% url exam.get_app_name|add:':mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p> <p><a href="{% url exam.get_app_name|add:':mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
{% endif %} {% endif %}