Use new classes for the interactive notifications

This commit is contained in:
Guewen Baconnier
2018-06-27 22:12:51 +02:00
committed by Yannick Vaucher
parent b333cdc7b1
commit bf7fda1980
3 changed files with 45 additions and 19 deletions

View File

@@ -8,11 +8,17 @@ var core = require('web.core'),
Widget.include({
do_notify: function(title, message, sticky, options) {
this.trigger_up('notification', {title: title, message: message, sticky: sticky, options: options});
do_interactive_notify: function(title, message, sticky, options) {
this.trigger_up(
'interactive_notification',
{title: title, message: message,
sticky: sticky, options: options});
},
do_warn: function(title, message, sticky, options) {
this.trigger_up('warning', {title: title, message: message, sticky: sticky, options: options});
do_interactive_warn: function(title, message, sticky, options) {
this.trigger_up(
'interactive_warning',
{title: title, message: message,
sticky: sticky, options: options});
},
});
@@ -22,14 +28,20 @@ WebClient.include({
{},
WebClient.prototype.custom_events,
{reload_active_view: 'reload_active_view',
notification: function (e) {
interactive_notification: function (e) {
if(this.notification_manager) {
this.notification_manager.notify(e.data.title, e.data.message, e.data.sticky, e.data.options);
this.notification_manager.interactive_notify(
e.data.title, e.data.message,
e.data.sticky, e.data.options
);
}
},
warning: function (e) {
interactive_warning: function (e) {
if(this.notification_manager) {
this.notification_manager.warn(e.data.title, e.data.message, e.data.sticky, e.data.options);
this.notification_manager.interactive_warn(
e.data.title, e.data.message,
e.data.sticky, e.data.options
);
}
}
}
@@ -79,12 +91,16 @@ WebClient.include({
},
on_message_warning: function(message){
if(this.notification_manager) {
this.notification_manager.do_warn(message.title, message.message, message.sticky, message);
this.notification_manager.do_interactive_warn(
message.title, message.message, message.sticky, message
);
}
},
on_message_info: function(message){
if(this.notification_manager) {
this.notification_manager.do_notify(message.title, message.message, message.sticky, message);
this.notification_manager.do_interactive_notify(
message.title, message.message, message.sticky, message
);
}
}
});