FormNotifications: Don't ignore warning and error notifications

This commit is contained in:
Johannes Meyer 2019-07-17 08:49:41 +02:00
parent 5c6d04f5d7
commit bc2e7588d7
2 changed files with 27 additions and 5 deletions

View File

@ -37,10 +37,7 @@ class FormNotifications extends Zend_Form_Decorator_Abstract
return $content;
}
$html = '<div class="form-notifications">'
. Icinga::app()->getViewRenderer()->view->icon('ok', '', ['class' => 'form-notification-icon'])
. '<ul class="form-notification-list">';
$html = '<ul class="form-notification-list">';
foreach (array(Form::NOTIFICATION_ERROR, Form::NOTIFICATION_WARNING, Form::NOTIFICATION_INFO) as $type) {
if (isset($notifications[$type])) {
$html .= '<li><ul class="notification-' . $this->getNotificationTypeName($type) . '">';
@ -59,6 +56,21 @@ class FormNotifications extends Zend_Form_Decorator_Abstract
}
}
if (isset($notifications[Form::NOTIFICATION_ERROR])) {
$icon = 'cancel';
$class = 'error';
} elseif (isset($notifications[Form::NOTIFICATION_WARNING])) {
$icon = 'warning-empty';
$class = 'warning';
} else {
$icon = 'info';
$class = 'info';
}
$html = "<div class=\"form-notifications $class\">"
. Icinga::app()->getViewRenderer()->view->icon($icon, '', ['class' => 'form-notification-icon'])
. $html;
switch ($this->getPlacement()) {
case self::APPEND:
return $content . $html . '</ul></div>';

View File

@ -386,7 +386,17 @@ form.icinga-forms {
}
.form-notifications {
background-color: fade(@color-ok, 20%);
&.info {
background-color: fade(@color-ok, 20%);
}
&.error {
background-color: fade(@color-critical, 30%);
}
&.warning {
background-color: fade(@color-warning, 40%);
}
}
.form-description {