Skip to content

Commit

Permalink
CSS: Introduce badge-nav-item
Browse files Browse the repository at this point in the history
refs #5543
  • Loading branch information
lippserd committed Oct 26, 2015
1 parent a359310 commit 6e5ba36
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
Expand Up @@ -94,7 +94,14 @@ abstract public function getCount();
*/
public function render(NavigationItem $item = null)
{
return '<div class="clearfix">' . $this->renderBadge() . parent::render($item) . '</div>';
if ($item === null) {
$item = $this->getItem();
}
$item->setCssClass('badge-nav-item');
$this->setEscapeLabel(false);
$label = $this->view()->escape($item->getLabel());
$item->setLabel($this->renderBadge() . $label);
return parent::render($item);
}

/**
Expand All @@ -107,7 +114,7 @@ protected function renderBadge()
if ($count = $this->getCount()) {
$view = $this->view();
return sprintf(
'<span title="%s" class="badge pull-right state-%s">%s</span>',
'<span title="%s" class="badge state-%s">%s</span>',
$view->escape($this->getTitle()),
$view->escape($this->getState()),
$count
Expand Down
20 changes: 11 additions & 9 deletions public/css/icinga/badges.less
@@ -1,15 +1,17 @@
/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */

.badge {
min-width: 25px;
font-family: tahoma, verdana, sans-serif;
background-color: @gray-light;
color: @text-color-inverted;
font-family: @font-family-wide;
font-size: @font-size-small;
font-weight: @font-weight-bold;
font-size: 11px;
line-height: 1;
min-width: 3em;
padding: @vertical-padding @horizontal-padding;
text-align: center;
color: @text-color-inverted;
padding-left: 5px;
padding-right: 5px;
padding-top: 2px;
padding-bottom: 2px;
background-color: @gray-light;
vertical-align: middle;
white-space: nowrap;

&.state-ok {
.bg-color-ok();
Expand Down
15 changes: 13 additions & 2 deletions public/css/icinga/nav.less
@@ -1,7 +1,18 @@
/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */

li.badge-nav-item {
> a {
.clearfix();

.badge {
float: right;
}
}
}

li.nav-item {
a, span {
> a,
> span {
// Rollover
display: block;
}
Expand All @@ -18,6 +29,6 @@ ul.tab-nav {
.clearfix();

li {
.pull-left();
float: left;
}
}

0 comments on commit 6e5ba36

Please sign in to comment.