49 lines
1.7 KiB
HTML
49 lines
1.7 KiB
HTML
<tr id="role-{{ r.id }}">
|
|
<td colspan="6">
|
|
<form hx-post="/admin/roles/{{ r.id }}"
|
|
hx-target="#role-{{ r.id }}"
|
|
hx-swap="outerHTML"
|
|
class="inline-edit">
|
|
<span class="muted">#{{ r.id }} · {{ r.name }}</span>
|
|
{% set role_perm_ids = r.permissions | map(attribute='id') | list %}
|
|
<fieldset class="roles-field">
|
|
<legend>Permissions</legend>
|
|
<table class="perm-matrix">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
{% for action in actions %}<th>{{ action }}</th>{% endfor %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for scope in scopes %}
|
|
<tr>
|
|
<td class="perm-scope">{{ scope }}</td>
|
|
{% for action in actions %}
|
|
{% set key = scope ~ ':' ~ action %}
|
|
{% if key in perm_map %}
|
|
{% set p = perm_map[key] %}
|
|
<td class="perm-cell">
|
|
<input type="checkbox" name="permission_ids" value="{{ p.id }}"
|
|
{{ 'checked' if p.id in role_perm_ids }}>
|
|
</td>
|
|
{% else %}
|
|
<td class="perm-cell perm-na">—</td>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</fieldset>
|
|
<div class="row-actions">
|
|
<button type="submit" class="btn btn-primary">Save</button>
|
|
<button type="button" class="btn btn-ghost"
|
|
hx-get="/admin/roles/{{ r.id }}/row"
|
|
hx-target="#role-{{ r.id }}"
|
|
hx-swap="outerHTML">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</td>
|
|
</tr>
|