Doing a relayout of permissions to make it a bit easier to navigate
This commit is contained in:
1 parent
1549971a13
commit
eba7896893
5 files changed
+138
-24
No files matched your search
@@ -5,14 +5,36 @@
|
||||
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>
|
||||
{% for perm in permissions %}
|
||||
<label class="check">
|
||||
<input type="checkbox" name="permission_ids" value="{{ perm.id }}"
|
||||
{{ "checked" if perm in r.permissions }}> {{ perm.name }}
|
||||
</label>
|
||||
{% endfor %}
|
||||
<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>
|
||||
|
||||
Reference in new issue
Block a user