Compare commits

..

No commits in common. "d2cebc7c670f6f97d4c0acdf393cf28c6a7ed748" and "13a372252dca81c1db6106209f2c91dd57901651" have entirely different histories.

View File

@ -79,39 +79,12 @@
<div class="w-full grid gap-3 mt-3"> <div class="w-full grid gap-3 mt-3">
<input type="hidden" name="id" value="{{ user.id }}" /> <input type="hidden" name="id" value="{{ user.id }}" />
<div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-3"> <div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-3">
{% for cluster, cluster_roles in roles | group_by(attribute="cluster") %} {# for cluster, r in roles | group_by(attribute="cluster") #}
<label for="cluster_{{ loop.index }}">{{ cluster }}</label> {# cluster #}
{# Determine the initially selected role within the cluster #}
{% set_global selected_role_id = "none" %}
{% for role in cluster_roles %}
{% if selected_role_id == "none" and role.name in user.roles %}
{% set_global selected_role_id = role.id %}
{% endif %}
{% endfor %}
{# Set default name to the selected role ID or first role if none selected #}
<select id="cluster_{{ loop.index }}"
name="roles[{% if selected_role_id != 'none' %}{{ selected_role_id }}{% else %}{{ cluster_roles[0].id }}{% endif %}]"
{% if allowed_to_edit == false %}disabled{% endif %}
onchange=" if (this.value === '') { this.removeAttribute('name'); } else { this.name = 'roles[' + this.options[this.selectedIndex].getAttribute('data-role-id') + ']'; }">
<option value=""
data-role-id="none"
{% if selected_role_id == 'none' %}selected="selected"{% endif %}>
None
</option>
{% for role in cluster_roles %}
<option value="on"
data-role-id="{{ role.id }}"
{% if role.id == selected_role_id %}selected="selected"{% endif %}>
{{ role.name }}
</option>
{% endfor %}
</select>
{% endfor %}
{% for role in roles %} {% for role in roles %}
{% if not role.cluster %}
{{ macros::checkbox(label=role.name, name="roles[" ~ role.id ~ "]", id=loop.index , checked=role.name in user.roles, disabled=allowed_to_edit == false) }} {{ macros::checkbox(label=role.name, name="roles[" ~ role.id ~ "]", id=loop.index , checked=role.name in user.roles, disabled=allowed_to_edit == false) }}
{% endif %}
{% endfor %} {% endfor %}
{# endfor #}
<hr class="sm:col-span-2 lg:col-span-4 my-3" /> <hr class="sm:col-span-2 lg:col-span-4 my-3" />
{% if user.membership_pdf %} {% if user.membership_pdf %}
<a href="/admin/user/{{ user.id }}/membership" <a href="/admin/user/{{ user.id }}/membership"