Skip to content
Snippets Groups Projects
Commit f203cabf authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by 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 dbab08c9
No related branches found
No related tags found
No related merge requests found
......@@ -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');
......
......@@ -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' ?>"
context="<?= htmlReady(Context::get() ? Context::get()->getFullName() : '') ?>"
:navigation="<?= htmlReady(json_encode(ResponsiveHelper::getNavigationObject($_COOKIE['responsive-navigation-hash'] ?? null))) ?>"
></responsive-navigation>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment