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): ?> <?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()): ?> <?php if($item->getUrl()): ?>
<a href="<?= $this->href($item->getUrl()); ?>"> <a href="<?= $this->href($item->getUrl()); ?>">
<?php endif; ?> <?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()): ?> <?php if($item->getUrl()): ?>
</a> </a>
<?php endif; ?> <?php endif; ?>
<?php if($item->hasChildren()) : <?php
echo $this->partial('parts/menu.phtml', array('items' => $item->getChildren(), 'sub' => true, 'url' => $this->url)); if($item->hasChildren()) {
endif; ?> echo $this->partial(
'parts/menu.phtml',
array('items' => $item->getChildren(), 'sub' => true, 'url' => $this->url)
);
}
?>
</li> </li>
<?php endforeach; ?> <?php endforeach ?>
</ul> </ul>

View File

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