45 lines
1.8 KiB
Twig
45 lines
1.8 KiB
Twig
{% macro users(view) %}
|
|
{% import "macros/widgets.html.twig" as widgets %}
|
|
|
|
{% set actions = {'search': {'class': 'search-toggle visible-xs-inline'}} %}
|
|
|
|
{% if view == 'index' %}
|
|
{% set actions = actions|merge({'visibility': '#modal_user_admin'}) %}
|
|
{% else %}
|
|
{% set actions = actions|merge({'back': path('admin_user')}) %}
|
|
{% endif %}
|
|
|
|
{% set actions = actions|merge({'download': {'url': path('user_export'), 'class': 'toolbar-action'}}) %}
|
|
|
|
{% if is_granted('create_user') %}
|
|
{% set actions = actions|merge({'create': {'url': path('admin_user_create')}}) %}
|
|
{% endif %}
|
|
|
|
{% if view == 'index' %}
|
|
{% set actions = actions|merge({'help': {'url': 'users.html'|docu_link, 'target': '_blank'}}) %}
|
|
{% elseif view == 'permissions' %}
|
|
{% set actions = actions|merge({'help': {'url': 'permissions.html'|docu_link, 'target': '_blank'}}) %}
|
|
{% endif %}
|
|
|
|
{% set actions = actions|merge({'help': {'url': 'users.html'|docu_link, 'target': '_blank'}}) %}
|
|
|
|
{% set event = trigger('actions.users', {'actions': actions, 'view': view}) %}
|
|
{{ widgets.page_actions(event.payload.actions) }}
|
|
{% endmacro %}
|
|
|
|
{% macro user_permissions(view) %}
|
|
{% deprecated 'The "user_permissions" macro from user/action.html.twig is deprecated since 1.14 and will be removed with 2.0. Use "permission/actions.html.twig" instead.' %}
|
|
{% import "permission/actions.html.twig" as realMacro %}
|
|
{{ realMacro.user_permissions(view) }}
|
|
{% endmacro %}
|
|
|
|
{% macro user(user, view, options) %}
|
|
{% import "macros/widgets.html.twig" as widgets %}
|
|
{% set event = actions(app.user, 'user', {'view': view, 'user': user}) %}
|
|
{% if view == 'index' %}
|
|
{{ widgets.table_actions(event.actions) }}
|
|
{% else %}
|
|
{{ widgets.page_actions(event.actions) }}
|
|
{% endif %}
|
|
{% endmacro %}
|