body.phtml: Update markup for `#notifications’

This commit is contained in:
Florian Strohmaier 2021-06-16 14:41:31 +02:00 committed by Johannes Meyer
parent 020e0c767a
commit 7ff1ca83b9
1 changed files with 21 additions and 1 deletions

View File

@ -3,6 +3,8 @@
use Icinga\Web\Url;
use Icinga\Web\Notification;
use Icinga\Authentication\Auth;
use ipl\Html\HtmlString;
use ipl\Web\Widget\Icon;
$moduleName = $this->layout()->moduleName;
if ($moduleName !== 'default') {
@ -70,7 +72,25 @@ if ($this->layout()->inlineLayout) {
$notifications = Notification::getInstance();
if ($notifications->hasMessages()) {
foreach ($notifications->popMessages() as $m) {
echo '<li class="' . $m->type . '">' . $this->escape($m->message) . '</li>';
switch ($m->type) {
case 'success':
$icon = new HtmlString(new Icon('check-circle'));
break;
case 'error':
$icon = new HtmlString(new Icon('times'));
break;
case 'warning':
$icon = new HtmlString(new Icon('exclamation-triangle'));
break;
case 'info':
$icon = new HtmlString(new Icon('info-circle'));
break;
default:
$icon = '';
break;
}
echo '<li class="' . $m->type . '">' . $icon . $this->escape($m->message) . '</li>';
}
}
?></ul>