From 25032204ee11c9f5aa9b7c91d5e08442da913c22 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 6 Mar 2014 09:41:22 +0000 Subject: [PATCH] Reorder history logic --- public/js/icinga/loader.js | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 9124093c1..46a9bba7a 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -255,8 +255,6 @@ active = $('[href].active', req.$target).attr('href'); } - req.$target.attr('data-icinga-url', url); - // var target = req.getResponseHeader('X-Icinga-Container'); var newBody = false; @@ -290,22 +288,6 @@ this.icinga.ui.setWindowId(windowId); } - // Update history when necessary. Don't do so for requests triggered - // by history or autorefresh events - if (! req.historyTriggered && ! req.autorefresh) { - - // We only want to care about top-level containers - if (req.$target.parent().closest('.container').length === 0) { - this.icinga.history.pushCurrentState(); - /* - this.icinga.logger.debug('Pushing ', req.url, ' to history'); - if (typeof window.history.pushState !== 'undefined') { - window.history.pushState({icinga: true}, null, req.url); - } - */ - } - } - // Handle search requests, still hardcoded if (req.url === '/search' && req.$target.data('icingaUrl') === '/search') @@ -334,6 +316,16 @@ req.$target.attr('data-icinga-url', req.url); req.$target.data('icingaUrl', req.url); + // Update history when necessary. Don't do so for requests triggered + // by history or autorefresh events + if (! req.historyTriggered && ! req.autorefresh) { + + // We only want to care about top-level containers + if (req.$target.parent().closest('.container').length === 0) { + this.icinga.history.pushCurrentState(); + } + } + /* Should we try to fiddle with responses containing full HTML? */ /* if ($('body', $resp).length) {