Do not focus logout menu item after a recurring login
Implement new MenuItemRenderer made for pages that are not part of the regular site navigation and should trigger a complete site reload instead of handling it via XHR.
This commit is contained in:
parent
cfb52eeadb
commit
4cf8da4bb9
|
@ -248,7 +248,8 @@ class Menu implements RecursiveIterator
|
||||||
|
|
||||||
$section->add(t('Logout'), array(
|
$section->add(t('Logout'), array(
|
||||||
'url' => 'authentication/logout',
|
'url' => 'authentication/logout',
|
||||||
'priority' => 700
|
'priority' => 700,
|
||||||
|
'renderer' => 'ForeignMenuItemRenderer'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Icinga\Web\Menu;
|
||||||
|
|
||||||
|
use Icinga\Web\Menu;
|
||||||
|
use Icinga\Web\Url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A menu item with a link that surpasses the regular navigation link behavior
|
||||||
|
*/
|
||||||
|
class ForeignMenuItemRenderer implements MenuItemRenderer {
|
||||||
|
|
||||||
|
public function render(Menu $menu)
|
||||||
|
{
|
||||||
|
return sprintf(
|
||||||
|
'<a href="%s" target="_self">%s%s<span></span></a>',
|
||||||
|
$menu->getUrl() ?: '#',
|
||||||
|
$menu->getIcon() ? '<img src="' . Url::fromPath($menu->getIcon()) . '" class="icon" /> ' : '',
|
||||||
|
htmlspecialchars($menu->getTitle())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue