From cc41fc25f33831a509b8890faaeab40325f0ebb3 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 21 Nov 2017 11:11:18 +0100 Subject: [PATCH] js, layout: detect initial layout on load fixes #3107 --- application/layouts/scripts/layout.phtml | 19 +++++++++++++++++++ public/js/icinga/ui.js | 10 ++++++++++ 2 files changed, 29 insertions(+) diff --git a/application/layouts/scripts/layout.phtml b/application/layouts/scripts/layout.phtml index c715ee1cd..e64577cc2 100644 --- a/application/layouts/scripts/layout.phtml +++ b/application/layouts/scripts/layout.phtml @@ -56,6 +56,25 @@ $innerLayoutScript = $this->layout()->innerLayout . '.phtml';
render($innerLayoutScript); ?>
+ diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js index 07af82446..866bea4b2 100644 --- a/public/js/icinga/ui.js +++ b/public/js/icinga/ui.js @@ -27,6 +27,16 @@ * @type {bool} */ this.mobileMenu = false; + + // detect currentLayout + var classList = $('#layout').attr('class').split(/\s+/); + var _this = this; + var matched; + $.each(classList, function(index, item) { + if (null !== (matched = item.match(/^([a-z]+)-layout$/))) { + _this.currentLayout = matched[1]; + } + }); }; Icinga.UI.prototype = {