Add mobile menu

fixes #8999
This commit is contained in:
Eric Lippmann 2015-11-16 14:21:08 +01:00
parent 0cc54ce34b
commit 583a4985c0
3 changed files with 43 additions and 3 deletions

View File

@ -256,7 +256,9 @@ html {
#layout.minimal-layout {
#sidebar {
display: none;
top: 0;
height: 32px;
width: 100%;
}
.dashboard > div.container {

View File

@ -189,3 +189,8 @@
}
}
}
#sidebar.expanded {
bottom: 0 !important;
height: auto !important;
}

View File

@ -20,6 +20,8 @@
this.debugTimer = null;
this.timeCounterTimer = null;
this.mobileMenu = false;
};
Icinga.UI.prototype = {
@ -533,8 +535,39 @@
if (! $('#layout').hasClass('fullscreen-layout')) {
$('#header').css({height: 'auto'});
$('#main').css({top: $('#header').css('height')});
$('#sidebar').css({top: $('#header').height() + 'px'});
if ($('#layout').hasClass('minimal-layout')) {
if (! this.mobileMenu) {
$('#header').css({top: $('#sidebar').height() + 'px'});
$('#main').css({
top: $('#header').height() + $('#sidebar').height()
});
$('#sidebar').css({
zIndex: 2
}).on('click', function (e) {
var $sidebar = $('#sidebar');
var $target = $(e.target);
var href = $target.attr('href');
if (href) {
if (href !== '#') {
$sidebar.removeClass('expanded');
}
} else if (! $target.is('input')) {
$sidebar.toggleClass('expanded');
}
$('#search').keypress(function(e) {
if (e.which === 13) {
$sidebar.removeClass('expanded');
}
});
}).prepend('<i class="icon-menu" style="vertical-align: middle;"></i>').css({
paddingBottom: 32
});
this.mobileMenu = true;
}
} else {
$('#main').css({top: $('#header').css('height')});
$('#sidebar').css({top: $('#header').height() + 'px'});
}
$('#header').css({height: $('#header').height() + 'px'});
$('#inner-layout').css({top: $('#header').css('height')});
}