Refactor auth group dropdown in profile and fragment templates for improved functionality and user experience

This commit is contained in:
Ross
2025-11-03 12:37:32 +00:00
parent 3461e45f93
commit 3a5ceabff0
3 changed files with 48 additions and 19 deletions
@@ -21,12 +21,12 @@
{% endif %}
{% if request.user.is_superuser or is_cid_user_manager %}
{% if available_auth_groups.count %}
<div class="dropdown">
<button class="btn btn-sm btn-outline-primary dropdown-toggle" type="button" id="addAuthGroupDropdown" data-bs-toggle="dropdown" aria-expanded="false">
Add
</button>
<ul class="dropdown-menu" aria-labelledby="addAuthGroupDropdown">
<div class="dropdown">
<button class="btn btn-sm btn-outline-primary dropdown-toggle" type="button" id="addAuthGroupDropdown" data-bs-toggle="dropdown" aria-expanded="false">
Add
</button>
<ul class="dropdown-menu" aria-labelledby="addAuthGroupDropdown">
{% if available_auth_groups.count %}
{% for ag in available_auth_groups %}
<li>
<button
@@ -39,8 +39,16 @@
</button>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% else %}
{% if request.user.is_superuser %}
<li>
<a class="dropdown-item" href="{% url 'admin:auth_group_add' %}" target="_blank" rel="noopener">Create permission group</a>
</li>
{% else %}
<li><span class="dropdown-item disabled">No groups available to add</span></li>
{% endif %}
{% endif %}
</ul>
</div>
{% endif %}
</div>