hide inactive delete user button #78 (#79)

This commit is contained in:
Kevin Papst
2018-01-10 23:14:58 +01:00
committed by GitHub
parent 36e72552d8
commit 2644818547
9 changed files with 33 additions and 164 deletions

View File

@@ -36,10 +36,14 @@
{% endfor %}
</td>
<td>
{{ widgets.button_group({
'edit': path('user_profile', {'username' : entry.username}),
'trash': path('user_profile_delete', {'username' : entry.username})
}) }}
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = {'edit': path('user_profile', {'username' : entry.username})}|merge(actionButtons) %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': '#'}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}