layout: Do not duplicate code from layout/menu.phtml in navigation.phtml

This commit is contained in:
Eric Lippmann 2015-01-22 13:47:45 +01:00
parent 9c47b2d949
commit 32c64f7e3d

View File

@ -3,7 +3,6 @@
use Icinga\Web\Url; use Icinga\Web\Url;
use Icinga\Web\Menu; use Icinga\Web\Menu;
use Icinga\Web\MenuRenderer; use Icinga\Web\MenuRenderer;
use Icinga\Web\Widget\SearchDashboard;
// Don't render a menu for unauthenticated users unless menu is auth aware // Don't render a menu for unauthenticated users unless menu is auth aware
if (! $this->auth()->isAuthenticated()) { if (! $this->auth()->isAuthenticated()) {
@ -11,15 +10,16 @@ if (! $this->auth()->isAuthenticated()) {
} }
?> ?>
<div <div id="menu" data-last-update="<?= (time() - 14) ?>000" data-base-target="_main" class="container"
id="menu" data-last-update="<?= (time() - 14) ?>000" data-base-target="_main" class="container" data-icinga-url="<?=$this->href('layout/menu');?>" data-icinga-url="<?= $this->href('layout/menu') ?>" data-icinga-refresh="15">
data-icinga-refresh="15" <?= $this->partial(
> 'layout/menu.phtml',
<? if (SearchDashboard::search('dummy')->getPane('search')->hasDashlets()): ?> 'default',
<form action="<?= $this->href('search') ?>" method="get" role="search"> array(
<input type="text" name="q" class="search autofocus" placeholder="<?= $this->translate('Search...') ?>" 'menuRenderer' => new MenuRenderer(
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" /> Menu::load(),
</form> Url::fromRequest()->without('renderLayout')->getRelativeUrl()
<? endif; ?> )
<?= new MenuRenderer(Menu::load(), Url::fromRequest()->without('renderLayout')->getRelativeUrl()); ?> )
) ?>
</div> </div>