Skip to content

Commit

Permalink
Prepare markup for new user menu
Browse files Browse the repository at this point in the history
refs #5543
  • Loading branch information
lippserd committed Sep 28, 2015
1 parent f68b8bc commit 9dff864
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
13 changes: 8 additions & 5 deletions library/Icinga/Application/Web.php
Expand Up @@ -297,9 +297,6 @@ public function getMenu()
)
),
'user' => array(
'label' => $this->user->getUsername(),
'icon' => 'user',
'priority' => 900,
'children' => array(
'preferences' => array(
'label' => t('Preferences'),
Expand All @@ -316,11 +313,17 @@ public function getMenu()
'url' => 'authentication/logout',
'priority' => 990,
'renderer' => array(
'NavigationItemRenderer',
'LogoutNavigationItemRenderer',
'target' => '_self'
)
)
)
),
'label' => $this->user->getUsername(),
'url' => 'account',
'priority' => 900,
'renderer' => array(
'UserNavigationItemRenderer'
),
)
);

Expand Down
@@ -0,0 +1,14 @@
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */

namespace Icinga\Web\Navigation\Renderer;

use Icinga\Web\Navigation\NavigationItem;

class LogoutNavigationItemRenderer extends NavigationItemRenderer
{
public function render(NavigationItem $item = null)
{
return '<div class="user-nav-item">' . parent::render($item) . '</div>';
}
}
@@ -0,0 +1,22 @@
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */

namespace Icinga\Web\Navigation\Renderer;

use Icinga\Web\Navigation\NavigationItem;

class UserNavigationItemRenderer extends NavigationItemRenderer
{
public function getAvatar()
{
return '<img class="pull-left user-avatar"
src="/icingaweb2/static/gravatar?email=icinga%40localhost"
alt="Avatar"
aria-hidden="true">';
}

public function render(NavigationItem $item = null)
{
return '<div class="user-nav-item clearfix">' . $this->getAvatar() . parent::render($item) . '</div>';
}
}
5 changes: 5 additions & 0 deletions public/css/icinga/main.less
Expand Up @@ -143,3 +143,8 @@ a.button {
.bg-color-critical();
}
}

.user-avatar {
height: 16px;
width: 16px;
}

0 comments on commit 9dff864

Please sign in to comment.