diff --git a/web_notify/static/src/js/notification.js b/web_notify/static/src/js/notification.js index ad305089..e4cb27ba 100644 --- a/web_notify/static/src/js/notification.js +++ b/web_notify/static/src/js/notification.js @@ -8,7 +8,8 @@ odoo.define('web_notify.notification', function (require) { Notification = base_notification.Notification, Warning = base_notification.Warning; - Notification.include({ + var InteractiveNotification = Notification.extend({ + template: 'InteractiveNotification', events: _.extend( {}, Notification.prototype.events, @@ -23,7 +24,7 @@ odoo.define('web_notify.notification', function (require) { } ), init: function(parent, title, text, sticky, options) { - this._super.apply(this, arguments); + this._super.apply(this, [parent, title, text, sticky]); this.options = options || {}; }, reload_active_view: function() { @@ -35,14 +36,23 @@ odoo.define('web_notify.notification', function (require) { } }); + var InteractiveWarning = InteractiveNotification.extend({ + template: 'InteractiveWarning', + }); + base_notification.NotificationManager.include({ - notify: function(title, text, sticky, options) { - return this.display(new Notification(this, title, text, sticky, options)); - }, - warn: function(title, text, sticky, options) { - return this.display(new Warning(this, title, text, sticky, options)); + interactive_notify(title, text, sticky, options) { + return this.display(new InteractiveNotification(this, title, text, sticky, options)); }, + interactive_warn(title, text, sticky, options) { + return this.display(new InteractiveWarning(this, title, text, sticky, options)); + } }); + return { + InteractiveNotification: InteractiveNotification, + InteractiveWarning: InteractiveWarning + }; + }); diff --git a/web_notify/static/src/js/web_client.js b/web_notify/static/src/js/web_client.js index 6fceb35b..d7309726 100644 --- a/web_notify/static/src/js/web_client.js +++ b/web_notify/static/src/js/web_client.js @@ -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 + ); } } }); diff --git a/web_notify/static/src/xml/notification.xml b/web_notify/static/src/xml/notification.xml index aa3df543..f620fa5c 100644 --- a/web_notify/static/src/xml/notification.xml +++ b/web_notify/static/src/xml/notification.xml @@ -17,14 +17,14 @@ - + - +