mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-20 20:34:25 +02:00
Only display custom menu renders on XHR requests and not in regular HTML
The main navigation should be rendered without a working backend. fixes #7143
This commit is contained in:
parent
b7c207a9cb
commit
71f55e388f
@ -23,7 +23,7 @@ class LayoutController extends ActionController
|
|||||||
|
|
||||||
$url = Url::fromRequest();
|
$url = Url::fromRequest();
|
||||||
$menu = new MenuRenderer(Menu::load(), $url->getRelativeUrl());
|
$menu = new MenuRenderer(Menu::load(), $url->getRelativeUrl());
|
||||||
$this->view->menuRenderer = $menu->useCustomRenderers();
|
$this->view->menuRenderer = $menu->useCustomRenderer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,7 +12,7 @@ if (! $this->auth()->isAuthenticated()) {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<div
|
<div
|
||||||
id="menu" data-base-target="_main" class="container" data-icinga-url="<?=$this->href('layout/menu');?>"
|
id="menu" data-last-update="<?= (time() - 14) ?>000" data-base-target="_main" class="container" data-icinga-url="<?=$this->href('layout/menu');?>"
|
||||||
data-icinga-refresh="15"
|
data-icinga-refresh="15"
|
||||||
>
|
>
|
||||||
<? if (SearchDashboard::search('dummy')->getPane('search')->hasComponents()): ?>
|
<? if (SearchDashboard::search('dummy')->getPane('search')->hasComponents()): ?>
|
||||||
|
@ -25,6 +25,11 @@ class MenuRenderer extends RecursiveIteratorIterator
|
|||||||
*/
|
*/
|
||||||
protected $tags = array();
|
protected $tags = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $useCustomRenderer = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new MenuRenderer
|
* Create a new MenuRenderer
|
||||||
*
|
*
|
||||||
@ -41,6 +46,15 @@ class MenuRenderer extends RecursiveIteratorIterator
|
|||||||
parent::__construct($menu, RecursiveIteratorIterator::CHILD_FIRST);
|
parent::__construct($menu, RecursiveIteratorIterator::CHILD_FIRST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $value
|
||||||
|
*/
|
||||||
|
public function useCustomRenderer($value = true)
|
||||||
|
{
|
||||||
|
$this->useCustomRenderer = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the outer ul opening html-tag
|
* Register the outer ul opening html-tag
|
||||||
*/
|
*/
|
||||||
@ -91,7 +105,7 @@ class MenuRenderer extends RecursiveIteratorIterator
|
|||||||
*/
|
*/
|
||||||
public function renderChild(Menu $child)
|
public function renderChild(Menu $child)
|
||||||
{
|
{
|
||||||
if ($child->getRenderer() !== null) {
|
if ($child->getRenderer() !== null && $this->useCustomRenderer) {
|
||||||
return $child->getRenderer()->render($child);
|
return $child->getRenderer()->render($child);
|
||||||
}
|
}
|
||||||
return sprintf(
|
return sprintf(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user