mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
Use new classes for the interactive notifications
This commit is contained in:
committed by
Yannick Vaucher
parent
b333cdc7b1
commit
bf7fda1980
@@ -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
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user