From 157818c8e77c7854694858a643a0f8b64c083267 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Tue, 9 Sep 2014 13:57:48 +0200 Subject: [PATCH] Fix navigation reload Activate the correct menu item with JavaScript after relaod and don't render it on server-side on XHR requests. --- application/controllers/LayoutController.php | 5 +++-- application/layouts/scripts/parts/navigation.phtml | 7 ++----- public/js/icinga/events.js | 14 +++++++++++--- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/application/controllers/LayoutController.php b/application/controllers/LayoutController.php index 7d2ea9ae5..614fa02a7 100644 --- a/application/controllers/LayoutController.php +++ b/application/controllers/LayoutController.php @@ -21,8 +21,9 @@ class LayoutController extends ActionController $this->setAutorefreshInterval(15); $this->_helper->layout()->disableLayout(); - $url = Url::fromPath($this->getParam('url')); - $this->view->menuRenderer = new MenuRenderer(Menu::load(), $url->getRelativeUrl()); + $url = Url::fromRequest(); + $menu = new MenuRenderer(Menu::load(), $url->getRelativeUrl()); + $this->view->menuRenderer = $menu->useCustomRenderers(); } /** diff --git a/application/layouts/scripts/parts/navigation.phtml b/application/layouts/scripts/parts/navigation.phtml index 5de8f3e40..f940be034 100644 --- a/application/layouts/scripts/parts/navigation.phtml +++ b/application/layouts/scripts/parts/navigation.phtml @@ -9,14 +9,11 @@ use Icinga\Web\Widget\SearchDashboard; if (! $this->auth()->isAuthenticated()) { return; } -$dataIcingaUrl = $this->href( - 'layout/menu', - array('url' => Url::fromRequest()->without('renderLayout')->getAbsoluteUrl()) -); ?>