topbar anpassungen

This commit is contained in:
2026-03-05 12:51:53 +01:00
parent c5f657c8c8
commit b2dab5bd6c
14 changed files with 494 additions and 113 deletions

View File

@@ -36,13 +36,14 @@ if ($bufferTitle !== '') {
</head>
<body>
<a class="app-skip-link" href="#app-main-content"><?php e(t('Skip to main content')); ?></a>
<div class="app-container">
<?php require __DIR__ . '/partials/app-main-aside-icon-bar.phtml'; ?>
<?php require __DIR__ . '/partials/app-main-aside.phtml'; ?>
<div class="app-main">
<main>
<?php require __DIR__ . '/partials/app-topbar.phtml'; ?>
<div class="app-main-content">
<div id="app-main-content" class="app-main-content" tabindex="-1">
<?php require __DIR__ . '/partials/app-flash.phtml'; ?>
<?php Buffer::get('html'); ?>
</div>

View File

@@ -16,7 +16,7 @@ $publicTarget = ltrim($publicTarget, '/');
<?php if ($variant === 'dropdown'): ?>
<details class="dropdown">
<summary>
<summary aria-label="<?php e(t('Language switcher')); ?>">
<i class="bi bi-translate"></i>
</summary>
<ul dir="rtl">
@@ -38,6 +38,24 @@ $publicTarget = ltrim($publicTarget, '/');
<?php endforeach; ?>
</ul>
</details>
<?php elseif ($variant === 'menu-items'): ?>
<?php foreach ($locales as $locale): ?>
<?php
$isActive = $locale === I18n::$locale;
$label = strtoupper((string) $locale);
$publicUrl = $base . '/' . $locale . ($publicTarget !== '' ? '/' . $publicTarget : '');
$switchUrl = $isLoggedIn
? ($baseUrl . '?locale=' . $locale . '&return=' . urlencode($returnTarget))
: $publicUrl;
?>
<li>
<a href="<?php e($switchUrl); ?>"
class="<?php e($isActive ? 'active' : ''); ?>"
<?php if ($isActive) { ?>aria-current="true"<?php } ?>>
<?php e(t('Language')); ?>: <?php e($label); ?>
</a>
</li>
<?php endforeach; ?>
<?php else: ?>
<?php if ($isLoggedIn): ?>
<form class="nav nav--lang" method="get" action="<?php e($baseUrl); ?>" aria-label="Language switcher">

View File

@@ -8,81 +8,63 @@ $userUuid = trim((string) ($user['uuid'] ?? ''));
$accountEditUrl = $userUuid !== '' ? lurl("admin/users/edit/{$userUuid}") : $accountUrl;
$themes = appThemes();
$theme = currentTheme();
$themeIcon = str_starts_with($theme, 'dark') ? 'bi-moon-stars-fill' : 'bi-sun-fill';
$csrfKey = Session::$csrfSessionKey;
$csrfToken = $_SESSION[$csrfKey] ?? '';
// Tenant switcher data
$currentTenant = $_SESSION['current_tenant'] ?? null;
$currentTenantId = $currentTenant['id'] ?? null;
$currentTenantId = (int) ($currentTenant['id'] ?? 0);
$availableTenants = $_SESSION['available_tenants'] ?? [];
$tenantLabel = trim((string) ($currentTenant['description'] ?? ''));
if ($tenantLabel === '') {
$tenantLabel = t('None');
}
$canSwitchTenant = is_array($currentTenant) && count($availableTenants) > 1;
$allowUserTheme = allowUserTheme();
?>
<header class="app-header">
<nav>
<ul>
<nav class="app-topbar">
<ul class="app-topbar-left">
<li>
<a id="global-back" data-tooltip-pos="bottom" data-tooltip="<?php e(t('Back')); ?> (Alt+←)" title="<?php e(t('Back')); ?> (Alt+←)" href="admin"><i class="bi bi-arrow-left"></i></a>
<a id="global-back" data-tooltip-pos="bottom" data-tooltip="<?php e(t('Back')); ?> (Alt+←)" title="<?php e(t('Back')); ?> (Alt+←)" aria-label="<?php e(t('Back')); ?> (Alt+←)" href="admin"><i class="bi bi-arrow-left"></i></a>
</li>
<li>
<a id="global-forward" data-tooltip-pos="bottom" data-tooltip="<?php e(t('Forward')); ?> (Alt+→)" title="<?php e(t('Forward')); ?> (Alt+→)" href="admin"><i class="bi bi-arrow-right"></i></a>
<a id="global-forward" data-tooltip-pos="bottom" data-tooltip="<?php e(t('Forward')); ?> (Alt+→)" title="<?php e(t('Forward')); ?> (Alt+→)" aria-label="<?php e(t('Forward')); ?> (Alt+→)" href="admin"><i class="bi bi-arrow-right"></i></a>
</li>
<li id="async-messages"></li>
</ul>
<ul class="nav-list">
<li data-tooltip="<?php e(t("Toggle Sidebar"));?>" data-tooltip-pos="bottom">
<button id="toggle-aside" data-sidebar-toggle data-sidebar-action="visibility"><i class="bi bi-layout-sidebar-inset"></i></button>
</li>
<li data-tooltip="<?php e(t("Toggle Detail Sidebar"));?>" data-tooltip-pos="bottom">
<button id="toggle-main-content-aside"><i class="bi bi-layout-sidebar-inset-reverse"></i></button>
</li>
<?php if (allowUserTheme()): ?>
<li data-tooltip="<?php e(t('Theme')); ?>" data-tooltip-pos="bottom">
<details class="dropdown"
data-theme-menu
data-theme-url="admin/users/theme"
data-csrf-key="<?php e($csrfKey); ?>"
data-csrf-token="<?php e($csrfToken); ?>">
<summary aria-label="<?php e(t('Toggle theme')); ?>">
<i class="bi <?php e($themeIcon); ?>" data-theme-icon></i>
<div class="app-topbar-center" aria-hidden="true"></div>
<ul class="app-topbar-right">
<li class="app-topbar-tenant-slot" data-tooltip="<?php e(t('Tenant')); ?>" data-tooltip-pos="bottom">
<?php if ($canSwitchTenant): ?>
<details class="dropdown app-topbar-tenant-menu">
<summary class="app-topbar-tenant-chip" aria-label="<?php e(t('Switch tenant')); ?>" title="<?php e($tenantLabel); ?>">
<span class="app-topbar-tenant-name"><?php e($tenantLabel); ?></span>
</summary>
<ul dir="rtl">
<?php foreach ($themes as $key => $label): ?>
<?php $isActiveTheme = $key === $theme; ?>
<li>
<a href="#" data-theme-option data-theme-value="<?php e($key); ?>"
class="<?php e($isActiveTheme ? 'active' : ''); ?>"
<?php echo $isActiveTheme ? 'aria-current="true"' : ''; ?>>
<?php e(t($label)); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</details>
</li>
<?php endif; ?>
<li data-tooltip="<?php e(t('High contrast')); ?>" data-tooltip-pos="bottom">
<button type="button" data-contrast-toggle aria-label="<?php e(t('Toggle contrast')); ?>">
<i class="bi bi-circle-half"></i>
</button>
</li>
<?php if ($currentTenant && count($availableTenants) > 1): ?>
<li data-tooltip="<?php e(t('Switch tenant')); ?>" data-tooltip-pos="bottom">
<details class="dropdown">
<summary><i class="bi bi-buildings"></i></summary>
<ul dir="rtl">
<ul class="app-topbar-menu-list app-topbar-menu-list--right">
<?php foreach ($availableTenants as $tenant): ?>
<?php $isActive = ($tenant['id'] ?? 0) === $currentTenantId; ?>
<?php
$tenantId = (int) ($tenant['id'] ?? 0);
$isActive = $tenantId === $currentTenantId;
$rowLabel = trim((string) ($tenant['description'] ?? ''));
if ($rowLabel === '') {
$rowLabel = t('None');
}
?>
<li>
<a href="#"
class="<?php echo $isActive ? 'active' : ''; ?>"
<?php if (!$isActive): ?>
data-switch-tenant="<?php e($tenant['id'] ?? ''); ?>"
data-csrf-key="<?php e($csrfKey); ?>"
data-csrf-token="<?php e($csrfToken); ?>"
data-error-message="<?php e(t('Failed to switch tenant')); ?>"
<?php endif; ?>>
<?php e($tenant['description'] ?? ''); ?>
class="<?php e($isActive ? 'active' : ''); ?>"
title="<?php e($rowLabel); ?>"
<?php if ($isActive): ?>
aria-current="true"
<?php else: ?>
data-switch-tenant="<?php e((string) $tenantId); ?>"
data-csrf-key="<?php e($csrfKey); ?>"
data-csrf-token="<?php e($csrfToken); ?>"
data-error-message="<?php e(t('Failed to switch tenant')); ?>"
<?php endif; ?>>
<?php e($rowLabel); ?>
<?php if ($isActive): ?>
<i class="bi bi-check"></i>
<?php endif; ?>
@@ -91,27 +73,79 @@ $availableTenants = $_SESSION['available_tenants'] ?? [];
<?php endforeach; ?>
</ul>
</details>
</li>
<?php endif; ?>
<li>
<?php
$variant = 'dropdown';
require __DIR__ . '/app-language-switcher.phtml';
unset($variant);
?>
<?php else: ?>
<span class="app-topbar-tenant-chip" aria-label="<?php e(t('Tenant')); ?>" title="<?php e($tenantLabel); ?>">
<span class="app-topbar-tenant-name"><?php e($tenantLabel); ?></span>
</span>
<?php endif; ?>
</li>
<li>
<details class="dropdown">
<summary><i class="bi bi-person-fill"></i></summary>
<ul dir="rtl">
<details class="dropdown app-topbar-user-menu"
<?php if ($allowUserTheme): ?>
data-theme-menu
data-theme-url="admin/users/theme"
data-csrf-key="<?php e($csrfKey); ?>"
data-csrf-token="<?php e($csrfToken); ?>"
<?php endif; ?>>
<summary aria-label="<?php e(t('Account')); ?>">
<i class="bi bi-person-fill"></i>
</summary>
<ul class="app-topbar-menu-list app-topbar-menu-list--right">
<li class="app-topbar-menu-heading" role="presentation"><small><?php e(t('Navigation')); ?></small></li>
<li>
<button type="button" class="app-topbar-menu-with-hotkey" id="toggle-aside" data-sidebar-toggle data-sidebar-action="visibility" aria-label="<?php e(t('Toggle Sidebar')); ?>">
<span><?php e(t('Toggle Sidebar')); ?></span>
<span class="app-topbar-hotkey" aria-hidden="true">Ctrl/Cmd+B</span>
</button>
</li>
<li class="app-topbar-menu-item-detail-sidebar">
<button type="button" id="toggle-main-content-aside" aria-label="<?php e(t('Toggle Detail Sidebar')); ?>">
<?php e(t('Toggle Detail Sidebar')); ?>
</button>
</li>
<li class="app-topbar-menu-divider" role="separator"></li>
<li class="app-topbar-menu-heading" role="presentation"><small><?php e(t('Display')); ?></small></li>
<?php if ($allowUserTheme): ?>
<?php foreach ($themes as $key => $label): ?>
<?php $isActiveTheme = $key === $theme; ?>
<li>
<a href="#"
data-theme-option
data-theme-value="<?php e($key); ?>"
class="<?php e($isActiveTheme ? 'active' : ''); ?>"
<?php echo $isActiveTheme ? 'aria-current="true"' : ''; ?>>
<?php e(t($label)); ?>
</a>
</li>
<?php endforeach; ?>
<?php endif; ?>
<li>
<button type="button" data-contrast-toggle aria-label="<?php e(t('Toggle contrast')); ?>" aria-pressed="false">
<?php e(t('High contrast')); ?>
</button>
</li>
<li class="app-topbar-menu-divider" role="separator"></li>
<li class="app-topbar-menu-heading" role="presentation"><small><?php e(t('Language')); ?></small></li>
<?php
$variant = 'menu-items';
require __DIR__ . '/app-language-switcher.phtml';
unset($variant);
?>
<li class="app-topbar-menu-divider" role="separator"></li>
<li class="app-topbar-menu-heading" role="presentation"><small><?php e(t('Account')); ?></small></li>
<li><a href="<?php e($accountEditUrl); ?>">
<?php e(t('Account')); ?>
<?php e(t('My account')); ?>
</a>
</li>
<li><a href="<?php e(lurl('help/hotkeys')); ?>">
<?php e(t('Keyboard shortcuts')); ?>
</a>
</li>
<li class="app-topbar-menu-divider" role="separator"></li>
<li class="app-topbar-menu-heading" role="presentation"><small><?php e(t('Session')); ?></small></li>
<li><a href="logout">
<?php e(t('Logout')); ?>
</a>