diff --git a/resources/vue/components/responsive/ResponsiveNavigation.vue b/resources/vue/components/responsive/ResponsiveNavigation.vue index fffce17d77ac7130949c6aa499fdd3ac8c1062e4..87084a5ae2ac4f809eecf3538cb3d5e0cacaa6b8 100644 --- a/resources/vue/components/responsive/ResponsiveNavigation.vue +++ b/resources/vue/components/responsive/ResponsiveNavigation.vue @@ -130,10 +130,6 @@ export default { type: String, default: '' }, - hasSidebar: { - type: Boolean, - default: true - }, navigation: { type: Object, required: true, @@ -162,6 +158,7 @@ export default { classObserver: null, dialogObserver: null, hasSkiplinks: document.querySelector('#skiplink_list') !== null, + hasSidebar: false, hasContentbar: false, contentbarTitle: '' } @@ -494,6 +491,8 @@ export default { } }, mounted() { + this.hasSidebar = document.querySelectorAll('#sidebar .sidebar-widget:not(#sidebar-navigation)').length > 0; + const cache = STUDIP.Cache.getInstance('responsive.'); const fullscreen = cache.get('fullscreen-mode') ?? false; const fullscreenDocument = document.documentElement.classList.contains('fullscreen-mode'); diff --git a/templates/header.php b/templates/header.php index 5ff5a1f5c74ca4e891ffb973145afa790389b437..f11b23c47927a1838d0155629f50a7746c4bea85 100644 --- a/templates/header.php +++ b/templates/header.php @@ -66,18 +66,12 @@ if ($navigation) { 'username' => $user->username, 'perm' => $GLOBALS['perm']->get_perm() ]; - - $navWidget = Sidebar::get()->countWidgets(NavigationWidget::class); - $allWidgets = Sidebar::get()->countWidgets(); - $hasSidebar = $allWidgets - $navWidget > 0; ?> <? } else { $me = ['username' => 'nobody']; - $hasSidebar = false; } ?> <responsive-navigation :me="<?= htmlReady(json_encode($me)) ?>" context="<?= htmlReady(Context::get() ? Context::get()->getFullName() : '') ?>" - :has-sidebar="<?= $hasSidebar ? 'true' : 'false' ?>" :navigation="<?= htmlReady(json_encode(ResponsiveHelper::getNavigationObject($_COOKIE['responsive-navigation-hash'] ?? null))) ?>" ></responsive-navigation> </div>