webui: use propert alerts in header notification area

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-05-28 18:08:13 +02:00
parent bedd128de0
commit bc6105b270
3 changed files with 5 additions and 22 deletions

View File

@ -50,11 +50,7 @@ textarea[readonly] {
.notification-area div { .notification-area div {
position: relative; position: relative;
left: -50%; left: -50%;
line-height: 1.5em;
z-index: 20; z-index: 20;
padding: 4px;
text-align: center;
word-wrap: break-word; word-wrap: break-word;
max-width: 500px; max-width: 500px;
} }

View File

@ -1164,8 +1164,6 @@ IPA.notify = function(message, type, timeout) {
} }
var notification_area = $('.notification-area'); var notification_area = $('.notification-area');
var message_el = $('.notification-area div');
if (notification_area.length === 0) { if (notification_area.length === 0) {
notification_area = $('<div/>', { notification_area = $('<div/>', {
'class': 'notification-area', 'class': 'notification-area',
@ -1174,25 +1172,14 @@ IPA.notify = function(message, type, timeout) {
notification_area.fadeOut(100); notification_area.fadeOut(100);
} }
}); });
message_el = $('<div/>', {
'class': 'alert'
}).appendTo(notification_area);
notification_area.appendTo('#container'); notification_area.appendTo('#container');
} }
notification_area.empty();
if (IPA.notify_success.current_cls) { var alert = IPA.alert_helper.create_alert('msg', message, type);
message_el.removeClass(IPA.notify_success.current_cls); var el = IPA.alert_helper.render_alert(alert);
IPA.notify_success.current_cls = null; notification_area.append(el);
}
if (type && type !== 'warning') {
var type_cls = 'alert-'+type;
message_el.addClass(type_cls);
IPA.notify_success.current_cls = type_cls;
}
message_el.text(message);
destroy_timeout(); destroy_timeout();
notification_area.fadeIn(IPA.config.message_fadein_time); notification_area.fadeIn(IPA.config.message_fadein_time);

View File

@ -5444,7 +5444,7 @@ IPA.value_map_widget = function(spec) {
* @alternateClassName IPA.alert_helper * @alternateClassName IPA.alert_helper
* @singleton * @singleton
*/ */
exp.alert_helper = { exp.alert_helper = IPA.alert_helper = {
/** /**
* Create alert object * Create alert object