allow adding users to exams by group
This commit is contained in:
@@ -39,44 +39,67 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<h3>Exams</h3>
|
||||
The group is currently associated with the following exams.
|
||||
The group is currently associated with the following exams. This allows the users within the group to be easily added to the exam. It will not automatically give members of the group access to the exam.
|
||||
{% if group_type == "cid" %}
|
||||
Add more <a href='{% url "generic:cid_group_exams" group.pk %}'>here</a>.
|
||||
{% else %}
|
||||
Add more <a href='{% url "generic:user_group_exams" group.pk %}'>here</a>.
|
||||
{% endif %}
|
||||
<p>It is possible to quickly add or remove all group candidates from an exam by clicking the buttons below. This will only affect the <b>{{users|length}}</b> candidates in this group. You will need to refresh the page to see updated candidate counts.</p>
|
||||
{% with group.GetGroupExams as exam_map %}
|
||||
{% for key, value in exam_map.items %}
|
||||
<h4>{{key}}</h4>
|
||||
<ul>
|
||||
<div>
|
||||
{% for exam in value %}
|
||||
<li>
|
||||
<a href="{{exam.get_absolute_url}}">{{exam}}</a>
|
||||
<div class="d-flex">
|
||||
<a href="{{exam.get_absolute_url}}" class="px-2">{{exam}}</a>
|
||||
{% if group_type == "cid" %}
|
||||
<a href="{{exam.get_cid_edit_url}}" class="edit-link">Edit candidates</a>
|
||||
<a href="{{exam.get_cid_edit_url}}" class="edit-link" px-2>Edit candidates</a>
|
||||
{% comment %} <button>Add group candidates</button>
|
||||
<button>Remove group candidates</button> {% endcomment %}
|
||||
{% else %}
|
||||
<a href="{{exam.get_user_edit_url}}" class="edit-link">Edit candidates</a>
|
||||
<a href="{{exam.get_user_edit_url}}" class="edit-link px-2">Edit candidates</a>
|
||||
<form>
|
||||
<input type="hidden" name="exam_id" value="{{exam.pk}}">
|
||||
<input type="hidden" name="exam_type" value="{{exam.app_name}}">
|
||||
<button
|
||||
class="btn btn-sm px-2"
|
||||
hx-post="{% url 'generic:user_group_add_candidates_to_exams' group.pk %}"
|
||||
title="Add all group candidates to this exam"
|
||||
name="action"
|
||||
value="add"
|
||||
>Add group candidates</button>
|
||||
<button
|
||||
hx-post="{% url 'generic:user_group_add_candidates_to_exams' group.pk %}"
|
||||
title="Remove all group candidates to this exam"
|
||||
class="btn btn-sm px-2"
|
||||
name="action"
|
||||
value="remove"
|
||||
>Remove group candidates</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
<span class="cid-number">
|
||||
|
||||
|
||||
<div class="px-2 ms-auto ">
|
||||
{% if group_type == "cid" %}
|
||||
(Cid candidate count: {{exam.valid_cid_users.count}})
|
||||
{% else %}
|
||||
(User candidate count: {{exam.valid_user_users.count}})
|
||||
{% endif %}
|
||||
</span>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<style>
|
||||
td, th { padding-left: 10px }
|
||||
|
||||
.cid-number {float: right}
|
||||
|
||||
.edit-link {
|
||||
font-size: smaller;
|
||||
opacity: 60%;
|
||||
|
||||
Reference in New Issue
Block a user