36 lines
2.0 KiB
Twig
36 lines
2.0 KiB
Twig
{#
|
|
The account menu behind the user's picture: own profile, the other areas (MenuBuilder::createUserMenu)
|
|
and logout. Opens on click, closes on a click elsewhere and on Escape.
|
|
#}
|
|
{% set user_menu = knp_menu_get('default_user') %}
|
|
<div class="relative"
|
|
{{ stimulus_controller('toggle', { open: false }, { closed: 'hidden' }) }}
|
|
{{ stimulus_action('toggle', 'closeOutside', 'click@window')|stimulus_action('toggle', 'close', 'keydown.esc@window') }}>
|
|
<button type="button"
|
|
class="flex items-center gap-x-2 text-sm text-ink hover:text-brand"
|
|
aria-haspopup="true"
|
|
{{ stimulus_action('toggle', 'toggle') }}>
|
|
{% if app.user.teamer and app.user.teamer.photo %}
|
|
<img src="{{ asset(app.user.teamer.photo | upload_filename_full | imagine_filter('profile')) }}"
|
|
class="h-8 w-8 rounded-full object-cover"
|
|
alt="">
|
|
{% else %}
|
|
{{ icon('user', 'w-8 h-8 text-brand') }}
|
|
{% endif %}
|
|
<span class="hidden sm:inline">{{ app.user.firstName }}</span>
|
|
</button>
|
|
<div class="hidden absolute right-0 top-full mt-2 z-40 min-w-56 border border-line bg-white py-1 text-sm shadow-lg"
|
|
role="menu"
|
|
{{ stimulus_target('toggle', 'toggle') }}>
|
|
{% if app.user.teamer %}
|
|
<a href="{{ path('app_teamer_profile_index') }}" class="user-menu-item" role="menuitem">{{ icon('user', 'w-5 h-5 text-muted') }}Mein Profil</a>
|
|
{% elseif is_granted('ROLE_ADMINISTRATIVE') %}
|
|
<a href="{{ path('app_administrative_profile_index') }}" class="user-menu-item" role="menuitem">{{ icon('user', 'w-5 h-5 text-muted') }}Mein Profil</a>
|
|
{% endif %}
|
|
{% for item in user_menu.children %}
|
|
{% if loop.last %}<hr class="my-1 border-line">{% endif %}
|
|
<a href="{{ item.uri }}" class="user-menu-item" role="menuitem">{{ icon(item.extras.icon, 'w-5 h-5 text-muted') }}{{ item.label }}</a>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|