Prepare markup for new user menu

refs #5543
This commit is contained in:
Eric Lippmann 2015-09-28 14:48:54 +02:00
parent f68b8bceee
commit 9dff864b80
4 changed files with 49 additions and 5 deletions

View File

@ -297,9 +297,6 @@ class Web extends EmbeddedWeb
)
),
'user' => array(
'label' => $this->user->getUsername(),
'icon' => 'user',
'priority' => 900,
'children' => array(
'preferences' => array(
'label' => t('Preferences'),
@ -316,11 +313,17 @@ class Web extends EmbeddedWeb
'url' => 'authentication/logout',
'priority' => 990,
'renderer' => array(
'NavigationItemRenderer',
'LogoutNavigationItemRenderer',
'target' => '_self'
)
)
)
),
'label' => $this->user->getUsername(),
'url' => 'account',
'priority' => 900,
'renderer' => array(
'UserNavigationItemRenderer'
),
)
);

View File

@ -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>';
}
}

View File

@ -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>';
}
}

View File

@ -143,3 +143,8 @@ a.button {
.bg-color-critical();
}
}
.user-avatar {
height: 16px;
width: 16px;
}