Skip to content
Snippets Groups Projects
Commit ed901fa0 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

don't rely on set data for determining whether a sidebar is present, check the...

Closes #3927

Merge request studip/studip!2883
parent 61beee8b
No related branches found
No related tags found
No related merge requests found
...@@ -130,10 +130,6 @@ export default { ...@@ -130,10 +130,6 @@ export default {
type: String, type: String,
default: '' default: ''
}, },
hasSidebar: {
type: Boolean,
default: true
},
navigation: { navigation: {
type: Object, type: Object,
required: true, required: true,
...@@ -162,6 +158,7 @@ export default { ...@@ -162,6 +158,7 @@ export default {
classObserver: null, classObserver: null,
dialogObserver: null, dialogObserver: null,
hasSkiplinks: document.querySelector('#skiplink_list') !== null, hasSkiplinks: document.querySelector('#skiplink_list') !== null,
hasSidebar: false,
hasContentbar: false, hasContentbar: false,
contentbarTitle: '' contentbarTitle: ''
} }
...@@ -494,6 +491,8 @@ export default { ...@@ -494,6 +491,8 @@ export default {
} }
}, },
mounted() { mounted() {
this.hasSidebar = document.querySelectorAll('#sidebar .sidebar-widget:not(#sidebar-navigation)').length > 0;
const cache = STUDIP.Cache.getInstance('responsive.'); const cache = STUDIP.Cache.getInstance('responsive.');
const fullscreen = cache.get('fullscreen-mode') ?? false; const fullscreen = cache.get('fullscreen-mode') ?? false;
const fullscreenDocument = document.documentElement.classList.contains('fullscreen-mode'); const fullscreenDocument = document.documentElement.classList.contains('fullscreen-mode');
......
...@@ -66,18 +66,12 @@ if ($navigation) { ...@@ -66,18 +66,12 @@ if ($navigation) {
'username' => $user->username, 'username' => $user->username,
'perm' => $GLOBALS['perm']->get_perm() 'perm' => $GLOBALS['perm']->get_perm()
]; ];
$navWidget = Sidebar::get()->countWidgets(NavigationWidget::class);
$allWidgets = Sidebar::get()->countWidgets();
$hasSidebar = $allWidgets - $navWidget > 0;
?> ?>
<? } else { <? } else {
$me = ['username' => 'nobody']; $me = ['username' => 'nobody'];
$hasSidebar = false;
} ?> } ?>
<responsive-navigation :me="<?= htmlReady(json_encode($me)) ?>" <responsive-navigation :me="<?= htmlReady(json_encode($me)) ?>"
context="<?= htmlReady(Context::get() ? Context::get()->getFullName() : '') ?>" context="<?= htmlReady(Context::get() ? Context::get()->getFullName() : '') ?>"
:has-sidebar="<?= $hasSidebar ? 'true' : 'false' ?>"
:navigation="<?= htmlReady(json_encode(ResponsiveHelper::getNavigationObject($_COOKIE['responsive-navigation-hash'] ?? null))) ?>" :navigation="<?= htmlReady(json_encode(ResponsiveHelper::getNavigationObject($_COOKIE['responsive-navigation-hash'] ?? null))) ?>"
></responsive-navigation> ></responsive-navigation>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment