Merge branch 'master' into feature/dope-layout-5543

This commit is contained in:
Eric Lippmann 2015-10-01 21:29:35 +02:00
commit 56ed92a8e6
4 changed files with 44 additions and 4 deletions

View File

@ -25,7 +25,7 @@ if (! $this->auth()->isAuthenticated()) {
'layout/menu.phtml',
'default',
array(
'menuRenderer' => Icinga::app()->getMenu()->getRenderer()
'menuRenderer' => Icinga::app()->getMenu()->getRenderer()->setUseStandardItemRenderer()
)
) ?>
</div>

View File

@ -44,7 +44,9 @@ class DashboardPane extends NavigationItem
}
if ($ordered) {
ksort($this->dashlets);
$dashlets = $this->dashlets;
ksort($dashlets);
return $dashlets;
}
return $this->dashlets;

View File

@ -8,6 +8,7 @@ use RecursiveIteratorIterator;
use Icinga\Exception\IcingaException;
use Icinga\Web\Navigation\Navigation;
use Icinga\Web\Navigation\NavigationItem;
use Icinga\Web\Navigation\Renderer\NavigationItemRenderer;
/**
* Renderer for multi level navigation
@ -25,6 +26,13 @@ class RecursiveNavigationRenderer extends RecursiveIteratorIterator implements N
*/
protected $content;
/**
* Whether to use the standard item renderer
*
* @var bool
*/
protected $useStandardRenderer;
/**
* Create a new RecursiveNavigationRenderer
*
@ -39,6 +47,29 @@ class RecursiveNavigationRenderer extends RecursiveIteratorIterator implements N
);
}
/**
* Set whether to use the standard navigation item renderer
*
* @param bool $state
*
* @return $this
*/
public function setUseStandardItemRenderer($state = true)
{
$this->useStandardRenderer = (bool) $state;
return $this;
}
/**
* Return whether to use the standard navigation item renderer
*
* @return bool
*/
public function getUseStandardItemRenderer()
{
return $this->useStandardRenderer;
}
/**
* {@inheritdoc}
*/
@ -132,7 +163,14 @@ class RecursiveNavigationRenderer extends RecursiveIteratorIterator implements N
/** @var NavigationItem $item */
if ($item->shouldRender()) {
$this->content[] = $this->getInnerIterator()->beginItemMarkup($item);
$this->content[] = $item->render();
if ($this->getUseStandardItemRenderer()) {
$renderer = new NavigationItemRenderer();
$this->content[] = $renderer->render($item);
} else {
$this->content[] = $item->render();
}
if (! $item->hasChildren()) {
$this->content[] = $this->getInnerIterator()->endItemMarkup();
}

View File

@ -77,7 +77,7 @@ class Dashboard extends AbstractWidget
foreach ($navigation as $dashboardPane) {
/** @var DashboardPane $dashboardPane */
$pane = new Pane($dashboardPane->getLabel());
foreach ($dashboardPane->getDashlets() as $title => $url) {
foreach ($dashboardPane->getDashlets(false) as $title => $url) {
$pane->addDashlet($title, $url);
}