feat: group the sidebar, add a settings hub and move account actions to a header user menu

This commit is contained in:
fromme committed 2026-11-12 11:13:30 +01:00
1 parent acd8e78e55
commit 7095456d36
16 files changed
+487 -477

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
{# The E&P logo with the app name beside it, as in the header of the apps portal (EP/apps) and epbms. #}
<span class="flex items-center gap-3">
<img class="h-9 w-auto" src="{{ asset('build/images/ep-logo.svg') }}" alt="E&amp;P Reisen &amp; Events" width="157" height="48">
<span class="pl-3 border-l border-line text-sm font-bold uppercase tracking-wide text-brand">Team</span>
</span>
+13 -9
View File
@@ -3,7 +3,7 @@
{% block list %}
{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
{% if item.level == 0 %}
<div class="min-h-full flex grow flex-col gap-y-5 lg:border-r border-gray-200 bg-white md:pr-6">
<div class="min-h-full flex grow flex-col gap-y-5">
<nav class="flex flex-1 flex-col">
<ul role="list" class="space-y-1">
{{ block('children') }}
@@ -19,7 +19,10 @@
{% endblock %}
{% block item %}
{% if item.displayed %}
{% if item.displayed and item.extras.heading is defined %}
{# the heading of a group of items, see AbstractMenuBuilder::addHeading() #}
<li class="px-2 pt-5 pb-1 text-[11px] font-semibold uppercase tracking-wide text-muted">{{ item.label|raw }}</li>
{% elseif item.displayed %}
<li>
{%- if item.hasChildren and item.displayChildren %}
<div {{ stimulus_controller('sidebar-menu', {'expanded': matcher.isAncestor(item)}, {'closed': 'hidden', 'iconClosed': 'text-gray-400', 'iconExpanded': 'text-gray-500'}) }}>
@@ -41,9 +44,10 @@
{% import _self as knp_menu %}
<a href="{{ item.uri }}"
class="{{ html_classes('', {
'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold text-gray-700 hover:bg-gray-50': item.level == 1,
'block rounded-md py-2 pr-2 pl-9 text-sm leading-6 text-gray-700 hover:bg-gray-50': item.level > 1,
'bg-gray-50': matcher.isCurrent(item) or matcher.isAncestor(item)
'group flex gap-x-3 p-2 text-sm leading-6 font-semibold': item.level == 1,
'block py-2 pr-2 pl-9 text-sm leading-6': item.level > 1,
'text-ink hover:bg-white/60 hover:text-brand': not (matcher.isCurrent(item) or matcher.isAncestor(item)),
'bg-white text-brand': matcher.isCurrent(item) or matcher.isAncestor(item)
}) }}"
{{ knp_menu.attributes(item.linkAttributes) }}>
{{ block('label') }}
@@ -57,14 +61,14 @@
{{ stimulus_action('sidebar-menu', 'toggleSubmenu') }}
{{ stimulus_target('sidebar-menu', 'button') }}
{{ knp_menu.attributes(item.linkAttributes) }}
class="{{ html_classes('hover:bg-gray-50 flex items-center w-full text-left rounded-md p-2 gap-x-3 text-sm leading-6 font-semibold text-gray-700', { 'bg-gray-50': matcher.isAncestor(item) }) }}"
class="{{ html_classes('hover:bg-white/60 hover:text-brand flex items-center w-full text-left p-2 gap-x-3 text-sm leading-6 font-semibold', { 'text-brand': matcher.isAncestor(item), 'text-ink': not matcher.isAncestor(item) }) }}"
aria-expanded="false">
{{ block('label') }}
</button>
{% elseif item.extras.divider is defined %}
<hr class="my-4 h-px bg-gray-200">
<hr class="my-4 h-px border-line">
{% else %}
<div class="hover:bg-gray-50 group flex gap-x-3 rounded-md p-2 text-sm leading-5 font-semibold text-gray-700"
<div class="hover:bg-white/60 group flex gap-x-3 p-2 text-sm leading-5 font-semibold text-ink"
role="button">
{{ block('label') }}
</div>
@@ -73,7 +77,7 @@
{% block label -%}
{% if item.extras.icon is defined -%}
{{ icon(item.extras.icon, 'h-5 w-5 shrink-0 text-gray-400') -}}
{{ icon(item.extras.icon, 'h-5 w-5 shrink-0 ' ~ ((matcher.isCurrent(item) or matcher.isAncestor(item)) ? 'text-brand' : 'text-muted')) -}}
<span class="flex-1">{{ item.label|raw }}</span>
{%- else -%}
{{ item.label|raw }}
+35
View File
@@ -0,0 +1,35 @@
{#
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>
@@ -0,0 +1,71 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Einstellungen{% endblock %}
{# role: who may open the page; the routes under app_admin_system_ are admin-only #}
{% set groups = [
{
title: 'Reisen & Besetzung',
pages: [
{ route: 'app_administrative_system_destination_index', label: 'Reisen', description: 'Reisen und ihre Destinationen', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_administrative_system_staffing_rule_index', label: 'Besetzungsmatrix', description: 'Wie jeder Termin eines Produkts besetzt wird – daraus entstehen die Einsatzentwürfe', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_admin_system_job_profile_index', label: 'Jobprofile', description: 'Die Aufgaben, für die Teamer:innen eingesetzt werden', role: 'ROLE_TEAM_ADMIN' },
{ route: 'app_admin_system_availability_index', label: 'Verfügbarkeiten', description: 'Zeiträume, für die Teamer:innen ihre Verfügbarkeit angeben', role: 'ROLE_TEAM_ADMIN' },
],
},
{
title: 'Teamer:innen',
pages: [
{ route: 'app_admin_system_fee_index', label: 'Honorare', description: 'Honorarsätze', role: 'ROLE_TEAM_ADMIN' },
{ route: 'app_admin_system_training_index', label: 'Fortbildungen', description: 'Fortbildungen, die bei Teamer:innen hinterlegt werden', role: 'ROLE_TEAM_ADMIN' },
{ route: 'app_admin_system_feedback_set_index', label: 'Feedbackvorlagen', description: 'Bewertungskategorien für das Teamer:innen-Feedback', role: 'ROLE_TEAM_ADMIN' },
],
},
{
title: 'Kommunikation',
pages: [
{ route: 'app_admin_system_email_text_index', label: 'E-Mail-Texte', description: 'Wortlaut der automatischen E-Mails', role: 'ROLE_TEAM_ADMIN' },
{ route: 'app_administrative_system_mailing_template_index', label: 'Mailvorlagen', description: 'Vorlagen für Rundmails an die Teamer:innen eines Einsatzes', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_administrative_system_news_index', label: 'News', description: 'Meldungen im Teambereich', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_administrative_system_faq_index', label: 'FAQ', description: 'Fragen und Antworten im Teambereich', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_admin_system_contact_index', label: 'Ansprechpersonen', description: 'Kontakte, die Teamer:innen im Teambereich sehen', role: 'ROLE_TEAM_ADMIN' },
],
},
{
title: 'Dokumente',
pages: [
{ route: 'app_administrative_system_document_index', label: 'Dokumente', description: 'Dokumente für Teamer:innen', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_administrative_system_season_task_document_index', label: 'Saisonteam-Dokumente', description: 'Standarddokumente der Saisonteam-Checkliste', role: 'ROLE_ADMINISTRATIVE' },
],
},
{
title: 'Zugänge',
pages: [
{ route: 'app_admin_system_user_index', label: 'Administrative Benutzer:innen', description: 'Zugänge für Admins, Management und Hausleitungen', role: 'ROLE_TEAM_ADMIN' },
],
},
] %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
Einstellungen
</h1>
<div class="space-y-8">
{% for group in groups %}
{% set pages = group.pages|filter(page => is_granted(page.role)) %}
{% if pages is not empty %}
<section>
<h2 class="pb-3 text-base font-semibold uppercase tracking-wide text-brand">{{ group.title }}</h2>
<div class="grid gap-4 sm:grid-cols-2 xl:grid-cols-3">
{% for page in pages %}
<a href="{{ path(page.route) }}" class="block border border-line bg-white p-4 hover:border-brand" {{ qa_attribute('settings-page', page.route) }}>
<span class="block font-semibold text-brand">{{ page.label }}</span>
<span class="block pt-1 text-muted">{{ page.description }}</span>
</a>
{% endfor %}
</div>
</section>
{% endif %}
{% endfor %}
</div>
{% endblock %}
+25 -28
View File
@@ -1,33 +1,30 @@
{% extends 'base.html.twig' %}
{% block body %}
<div class="max-w-screen-2xl mx-auto px-4 lg:px-8 lg:grid lg:grid-cols-[14.5rem_minmax(0,1fr)] gap-8 py-8">
<div class="lg:col-span-full flex items-center justify-between pb-4 lg:pb-0">
<a href="{{ path(app.user ? app.user.defaultRoute : 'app_security_login') }}">
<img class="h-8 w-auto" src="{{ asset('build/images/logo.svg') }}" alt="E&amp;P Team">
</a>
{% if app.user %}
<div class="flex items-center space-x-4">
{% if app.user.teamer and app.user.teamer.photo %}
<a href="{{ path('app_teamer_profile_index') }}" title="Mein Profil">
<img src="{{ asset(app.user.teamer.photo | upload_filename_full | imagine_filter('profile')) }}"
class="h-8 w-auto rounded-full"
alt="{{ app.user.teamer.firstName }}">
</a>
{% elseif is_granted('ROLE_ADMINISTRATIVE') %}
<a href="{{ path('app_administrative_profile_index') }}" title="Mein Profil">
{{ icon('user', 'w-8 h-8') }}
</a>
{% endif %}
<button type="button"
class="lg:hidden"
{{ stimulus_controller('mobilenav', [], [], { 'mobilenav': '#mobilenav' }) }}
{{ stimulus_action('mobilenav', 'trigger', null, { 'mode': 'open' }) }}>
{{ icon('menu', 'w-8 h-8 text-gray-700') }}
</button>
</div>
{% endif %}
{# E&P header as in the apps portal (EP/apps) and epbms: logo with the app name, brand bar #}
<header>
<div class="border-b border-line bg-white">
<div class="max-w-screen-2xl mx-auto px-4 lg:px-8 py-3 flex items-center justify-between gap-x-4">
<a href="{{ path(app.user ? app.user.defaultRoute : 'app_security_login') }}">
{% include '_partials/_brand.html.twig' %}
</a>
{% if app.user %}
<div class="flex items-center gap-x-4">
{% include '_partials/_user_menu.html.twig' %}
<button type="button"
class="lg:hidden"
{{ stimulus_controller('mobilenav', [], [], { 'mobilenav': '#mobilenav' }) }}
{{ stimulus_action('mobilenav', 'trigger', null, { 'mode': 'open' }) }}>
<span class="sr-only">Menü</span>
{{ icon('menu', 'w-8 h-8 text-brand') }}
</button>
</div>
{% endif %}
</div>
</div>
<div class="h-2 bg-brand" aria-hidden="true"></div>
</header>
<div class="max-w-screen-2xl mx-auto px-4 lg:px-8 lg:grid lg:grid-cols-[14.5rem_minmax(0,1fr)] gap-8 py-8">
<div class="hidden lg:block">
{% block main_menu %}{% endblock %}
</div>
@@ -39,9 +36,9 @@
class="fixed z-50 top-0 left-0 inset-0 pr-16 bg-black/70 -translate-x-full"
{{ stimulus_controller('mobilenav', [], { 'closed': '-translate-x-full' }, { 'mobilenav': '#mobilenav' }) }}
>
<div class="h-screen w-full bg-white">
<div class="h-screen w-full bg-page">
<div class="flex justify-between p-8">
<img src="{{ asset('build/images/logo.svg') }}" alt="" class="block w-auto h-8">
<img src="{{ asset('build/images/ep-logo.svg') }}" alt="" class="block w-auto h-9">
<button type="button"
{{ stimulus_action('mobilenav', 'trigger', null, { 'mode': 'close' }) }}>
{{ icon('close', 'w-8 h-8') }}