From 07cd24b1ecf3ab8edd3fffbf2fcd3a3e685f357c Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 29 Mar 2018 17:46:24 +0200 Subject: [IMP] web: convert notification popup in service and add buttons params this.call('web.Notification', 'notify', params) Display a notification at the appropriate location, and returns the reference id to the same widget. Note that this method does not wait for the appendTo method to complete. @param {Object} params @param {string} params.title notification title @param {string} params.message notification main message @param {string} params.type 'notification' or 'warning' @param {boolean} [params.sticky=false] if true, the notification will stay visible until the user clicks on it. @param {string} [params.className] className to add on the dom @param {function} [params.onClose] callback when the user click on the x or when the notification is auto close (no sticky) @param {Array} params.buttons @param {function} params.buttons[0].click callback on click @param {Boolean} [params.buttons[0].primary] display the button as primary @param {string} [params.buttons[0].text] button label @param {string} [params.buttons[0].icon] font-awsome className or image src @returns {Number} notification id this.call('web.Notification', 'close', notificationId) --- addons/web/static/src/js/core/service_mixins.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js/core') diff --git a/addons/web/static/src/js/core/service_mixins.js b/addons/web/static/src/js/core/service_mixins.js index 4ab0a361988..463b0aef4b1 100644 --- a/addons/web/static/src/js/core/service_mixins.js +++ b/addons/web/static/src/js/core/service_mixins.js @@ -185,10 +185,10 @@ var ServicesMixin = { return def; }, do_notify: function (title, message, sticky, className) { - this.trigger_up('notification', {title: title, message: message, sticky: sticky, className: className}); + return this.call('notification', 'notify', {title: title, message: message, sticky: sticky, className: className}); }, do_warn: function (title, message, sticky, className) { - this.trigger_up('warning', {title: title, message: message, sticky: sticky, className: className}); + return this.call('notification', 'notify', {type: 'warning', title: title, message: message, sticky: sticky, className: className}); }, }; -- cgit v1.2.3