Files
myep/templates/layout_admin.html.twig
T

51 lines
2.3 KiB
Twig

{#
The admin in the sidebar layout of the E&P corporate design: the KnpMenu menu `admin_main` in a
left sidebar from lg up, below that in a drawer behind the menu button.
#}
{% extends 'base_admin.html.twig' %}
{% block body %}
<div {{ stimulus_controller('drawer') }}>
{% embed 'admin/_partials/_header.html.twig' with {
app_name: 'MyE&P Admin',
home_path: path(app.user ? 'app_admin_dashboard' : 'app_login'),
header_width: 'mx-auto max-w-screen-2xl px-4 lg:px-8',
} %}
{% block header_end %}
{% if app.user %}
<span class="hidden self-center text-muted sm:inline">{{ app.user.userIdentifier }}</span>
<button type="button" class="btn-tool self-center lg:hidden" aria-haspopup="dialog"
{{ stimulus_action('drawer', 'open') }}>Menü</button>
{% endif %}
{% endblock %}
{% endembed %}
<div class="mx-auto max-w-screen-2xl gap-8 px-4 py-8 lg:grid lg:grid-cols-[14.5rem_minmax(0,1fr)] lg:px-8">
<nav aria-label="Hauptmenü" class="hidden lg:block">
{% if app.user %}
{{ knp_menu_render('admin_main') }}
{% endif %}
</nav>
<main id="content" tabindex="-1" class="min-w-0 outline-none">
{% block content %}{% endblock %}
</main>
</div>
{% if app.user %}
<dialog class="drawer" aria-label="Hauptmenü" {{ stimulus_target('drawer', 'dialog') }}
{{ stimulus_action('drawer', 'closeOnBackdrop', 'click') }}>
{# fills the dialog, so only clicks beside the drawer reach the dialog element itself #}
<div class="flex h-full flex-col">
<div class="flex items-center justify-between p-4">
<img src="{{ asset('build/images/ep-logo.svg') }}" alt="" class="h-9 w-auto">
<button type="button" class="btn-tool" {{ stimulus_action('drawer', 'close') }}>Schließen</button>
</div>
<nav class="flex-1 overflow-y-auto px-4 pb-8">
{{ knp_menu_render('admin_main') }}
</nav>
</div>
</dialog>
{% endif %}
</div>
{% endblock %}