mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 13:54:26 +02:00
Add icon with first letter of the li if there is no icon set else default to icon-circle
This commit is contained in:
parent
504c7cd5d8
commit
61b0d8aa90
@ -100,15 +100,8 @@ abstract class BadgeNavigationItemRenderer extends NavigationItemRenderer
|
||||
$item->setCssClass('badge-nav-item');
|
||||
$this->setEscapeLabel(false);
|
||||
$label = $this->view()->escape($item->getLabel());
|
||||
if (($icon = $item->getIcon()) !== null) {
|
||||
$label = $this->view()->icon($icon) . $label;
|
||||
$item->setIcon(null);
|
||||
}
|
||||
$item->setLabel($this->renderBadge() . $label);
|
||||
$html = parent::render($item);
|
||||
if ($icon) {
|
||||
$item->setIcon(true);
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
@ -178,6 +178,9 @@ class NavigationItemRenderer
|
||||
: $item->getLabel();
|
||||
if (($icon = $item->getIcon()) !== null) {
|
||||
$label = $this->view()->icon($icon) . $label;
|
||||
} else {
|
||||
$firstLetter = $item->getName()[0];
|
||||
$label = $this->view()->icon('letter', null, ['data-letter' => strtolower($firstLetter)]) . $label;
|
||||
}
|
||||
|
||||
if (($url = $item->getUrl()) !== null) {
|
||||
|
@ -322,11 +322,6 @@ class NavigationRenderer implements RecursiveIterator, NavigationRendererInterfa
|
||||
$cssClasses[] = static::CSS_CLASS_ACTIVE;
|
||||
}
|
||||
|
||||
if ($item->getIcon() === null) {
|
||||
// @TODO(el): Add constant
|
||||
$cssClasses[] = 'no-icon';
|
||||
}
|
||||
|
||||
if ($cssClass = $item->getCssClass()) {
|
||||
$cssClasses[] = $cssClass;
|
||||
}
|
||||
|
@ -94,6 +94,13 @@
|
||||
&:not(.active) > a > i {
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
& > a > .icon-letter:before {
|
||||
content: attr(data-letter);
|
||||
font-family: @font-family;
|
||||
font-weight: 800;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
|
||||
ul:not(.nav-level-2) > .selected > a {
|
||||
|
Loading…
x
Reference in New Issue
Block a user