Menu: Fix HTML

refs #3759
This commit is contained in:
Eric Lippmann 2014-01-28 13:34:11 +01:00
parent 48f5eebd53
commit 59cb1d3cc7
2 changed files with 31 additions and 13 deletions

View File

@ -1,16 +1,38 @@
<?php echo ($this->sub) ? '<ul>' : '<ul class="nav nav-stacked" role="navigation" id="icinganavigation">' ?>
<?= $this->sub ? '<ul>' : '<ul class="nav nav-stacked" role="navigation" id="icinganavigation">' ?>
<?php foreach ($this->items as $item): ?>
<li class="<?php echo ($this->sub) ? 'submenu ' : '' ; echo $item->getIconClass(); echo ($this->href($this->url) === $this->href($item->getUrl())) ? ' active' : ''; ?>">
<?php
$itemClass = '';
if ($this->sub) {
$itemClass .= 'submenu ';
}
if ($this->href($this->url) === $this->href($item->getUrl())) {
$itemClass .= 'active ';
}
?>
<li <?php if (!empty($itemClass)): ?>class="<?= $itemClass ?>"<?php endif ?>>
<?php if($item->getUrl()): ?>
<a href="<?= $this->href($item->getUrl()); ?>">
<?php endif; ?>
<?= ($item->getIcon()) ? $this->img($item->getIcon(), array('height' => '16px', 'width' => '16px')) : ''; ?> <?= $item->getTitle();?>
<?php
if ($icon = $item->getIcon()) {
echo $this->img($icon, array('height' => '16px', 'width' => '16px'));
}
?>
<?php if ($iconClass = $item->getIconClass()): ?>
<i class="<?= $iconClass ?>"></i>
<?php endif ?>
<?= $item->getTitle();?>
<?php if($item->getUrl()): ?>
</a>
<?php endif; ?>
<?php if($item->hasChildren()) :
echo $this->partial('parts/menu.phtml', array('items' => $item->getChildren(), 'sub' => true, 'url' => $this->url));
endif; ?>
<?php
if($item->hasChildren()) {
echo $this->partial(
'parts/menu.phtml',
array('items' => $item->getChildren(), 'sub' => true, 'url' => $this->url)
);
}
?>
</li>
<?php endforeach; ?>
</ul>
<?php endforeach ?>
</ul>

View File

@ -85,10 +85,6 @@
color: red;
}
.testclass > a{
color: green;
}
.active > a{
font-weight: bold;
text-decoration: underline;
@ -207,4 +203,4 @@ ul.icinga-subnavigation {
.nav > .subclass {
text-decoration: underline;
font-size: 16px;
}
}