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,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
};
});