From 462c3956d9988e9477de48788d370be1b1c4f107 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 26 Feb 2018 14:50:55 +0100 Subject: [FIX] web: NotificationManager: warnings style Warnings are styled a bit differently than notifications, as their background is red (thanks to classname 'o_error' on the warning root element). This classname isn't correctly added since rev. 920df59, which changed the root element of the 'Notification' template, which is extended by the 'Warning' template, making qweb.js fail to add the 'o_error' classname. --- addons/web/static/src/js/widgets/notification.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/widgets/notification.js') diff --git a/addons/web/static/src/js/widgets/notification.js b/addons/web/static/src/js/widgets/notification.js index 6e11b4c8647..a162c6bc330 100644 --- a/addons/web/static/src/js/widgets/notification.js +++ b/addons/web/static/src/js/widgets/notification.js @@ -1,7 +1,6 @@ odoo.define('web.notification', function (require) { "use strict"; -var core = require('web.core'); var Widget = require('web.Widget'); var Notification = Widget.extend({ @@ -47,6 +46,13 @@ var Notification = Widget.extend({ var Warning = Notification.extend({ template: 'Warning', + /** + * @override + */ + start: function () { + this.$el.addClass('o_error'); + return this._super.apply(this, arguments); + }, }); var NotificationManager = Widget.extend({ -- cgit v1.2.3 From a34357275fe731634c45ea07607f744d8c44b36e Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 5 Mar 2018 15:11:12 +0100 Subject: [FIX] web: bug introduced by forwardport 36945a58 PhantomJS doesn't like widgets that define two start functions. --- addons/web/static/src/js/widgets/notification.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'addons/web/static/src/js/widgets/notification.js') diff --git a/addons/web/static/src/js/widgets/notification.js b/addons/web/static/src/js/widgets/notification.js index 2d987944d30..d05a0be380c 100644 --- a/addons/web/static/src/js/widgets/notification.js +++ b/addons/web/static/src/js/widgets/notification.js @@ -34,7 +34,8 @@ var Notification = Widget.extend({ this.title = params.title; this.text = params.text; this.sticky = !!params.sticky; - if (params.type === 'warning') { + this.type = params.type; + if (this.type === 'warning') { this.template = 'Warning'; } }, @@ -43,6 +44,9 @@ var Notification = Widget.extend({ */ start: function () { var self = this; + if (this.type === 'warning') { + this.$el.addClass('o_error'); + } return this._super.apply(this, arguments).then(function () { self.$el.animate({opacity: 1.0}, 400, "swing", function () { if(!self.sticky) { @@ -68,13 +72,6 @@ var Notification = Widget.extend({ self.$el.animate({height: 0}, 400, "swing", self.destroy.bind(self)); }); }, - /** - * @override - */ - start: function () { - this.$el.addClass('o_error'); - return this._super.apply(this, arguments); - }, //-------------------------------------------------------------------------- // Handlers -- cgit v1.2.3