SPR-953: bugfixes for content-wide nav

This commit is contained in:
Jana Deutschländer 2017-04-27 17:40:46 +02:00
commit 30aa8e9544
5 changed files with 31 additions and 8 deletions

View file

@ -173,7 +173,8 @@
}
// without wrapping UL
nav > a.nav {
nav > a.nav,
nav div.nav a{
margin-left: -3.5rem;
@media @screen_md-lg {

View file

@ -43,7 +43,7 @@
@fix_border-radius: 3px; // inputs, editbox (textarea), buttons, content, code, quicksearch, msg
@toggle-showsidebar_width: 3.07rem; // shown sidebar after toggle
@toggle-showsidebar_width: 3.47rem; // shown sidebar after toggle
@headericons-margin-xxs: .45rem; // screen xxs margin-top for header icons

View file

@ -166,7 +166,7 @@
.wide-content.showSidebar {
.content {
.row > .col-xs-12 {
margin-left: 2.1rem;
margin-left: 2.3rem;
}
}
}

View file

@ -29,6 +29,9 @@
nav.nav-starred {
ul {
list-style: none;
&#sidebar-menu-starred {
margin-left: 0;
}
li {
margin-left: 0;
svg {

View file

@ -24,7 +24,7 @@ jQuery(function () {
if (!item) {
continue;
}
window.sessionStorage.removeItem('sidebar-section-' + index + '-open');
window.sessionStorage.setItem('sidebar-section-' + index + '-open', 'false');
}
},
@ -254,12 +254,20 @@ jQuery(function () {
$templateMenus = $nav.find('> nav:not(.nav-main)'),
stModes = ['recent', 'media', 'index'],
utModes = ['profile','admin'];
utModes = ['profile','admin'],
isWideContent = false;
/* set active states for site tool menu and user tool menu */
setActive(stModes,$siteTools);
setActive(utModes,$userTools);
if(jQuery('body').is('.wide-content')) {
window.sessionStorage.setItem('wide-content', true);
isWideContent = true;
}
/* set data attributes for sessionStorage and check onload if one of the template menus should be opened */
$templateMenus.each(function( index ) {
var $t = jQuery(this).find('.nav'),
@ -267,14 +275,25 @@ jQuery(function () {
$toggler = ($t.is('a')) ? $t : $t.find('a:last'),
tIndex = y + index;
$toggler.data('index', tIndex);
if (window.sessionStorage.getItem('sidebar-section-' + tIndex + '-open') === 'true') {
jQuery(this).find('.nav-panel').css('display', 'block');
setTogglerClass($toggler,'is-open');
var item = window.sessionStorage.getItem('sidebar-section-' + tIndex + '-open');
if (item) {
if(isWideContent) {
window.sessionStorage.setItem('sidebar-section-' + tIndex + '-open', 'false');
} else {
if (item === 'true') {
jQuery(this).find('.nav-panel').css('display', 'block');
setTogglerClass($toggler, 'is-open');
}
}
}
//console.log(window.sessionStorage);
});
};
// main
initContentNav();
initSidebarToggling();