diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-10-06 09:25:57 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-10-18 13:31:17 +0200 |
| commit | 1503ec888362216b90099bd5cfb9affc53de20d4 (patch) | |
| tree | 97503b50f55b8b2518cfa73bb843e0f0ef0bd94f /addons/web/static/src | |
| parent | e302ca7b3d67ead978022ecced51a6de4345983b (diff) | |
[FIX] web: make rainbowMan more solid
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/chrome/abstract_web_client.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/widgets/rainbow_man.js | 51 |
2 files changed, 27 insertions, 26 deletions
diff --git a/addons/web/static/src/js/chrome/abstract_web_client.js b/addons/web/static/src/js/chrome/abstract_web_client.js index febfecad0bc..dbf6937937d 100644 --- a/addons/web/static/src/js/chrome/abstract_web_client.js +++ b/addons/web/static/src/js/chrome/abstract_web_client.js @@ -21,7 +21,7 @@ var Dialog = require('web.Dialog'); var Loading = require('web.Loading'); var mixins = require('web.mixins'); var NotificationManager = require('web.notification').NotificationManager; -var RainbowMan = require('web.rainbow_man'); +var RainbowMan = require('web.RainbowMan'); var session = require('web.session'); var Widget = require('web.Widget'); diff --git a/addons/web/static/src/js/widgets/rainbow_man.js b/addons/web/static/src/js/widgets/rainbow_man.js index 53624b6322d..16d4d9a1e3d 100644 --- a/addons/web/static/src/js/widgets/rainbow_man.js +++ b/addons/web/static/src/js/widgets/rainbow_man.js @@ -1,27 +1,40 @@ -odoo.define('web.rainbow_man', function (require) { +odoo.define('web.RainbowMan', function (require) { "use strict"; -var ajax = require("web.ajax"); +/** + * The RainbowMan widget is the widget displayed by default as a 'fun/rewarding' + * effect in some cases. For example, when the user marked a large deal as won, + * or when he cleared its inbox. + * + * This widget is mostly a picture and a message with a rainbow animation around + * If you want to display a RainbowMan, you probably do not want to do it by + * importing this file. The usual way to do that would be to use the effect + * service (by triggering the 'show_effect' event) + */ + var Widget = require('web.Widget'); var core = require('web.core'); -var qweb = core.qweb; + var _t = core._t; var RainbowMan = Widget.extend({ template: 'rainbow_man.notification', + xmlDependencies: ['/web/static/src/xml/rainbow_man.xml'], /** * @override * @constructor - * @param {Object} [options] - key-value options to decide rainbowman behavior / appearance - * @param {string} [options.message] - Message to be displayed on rainbowman card - * @param {string} [options.fadeout] - * Delay for rainbowman to disappear - [options.fadeout='fast'] will make rainbowman - * dissapear quickly, [options.fadeout='medium'] and [options.fadeout='slow'] will - * wait little longer before disappearing (can be used when [options.message] - * is longer), [options.fadeout='no'] will keep rainbowman on screen until - * user clicks anywhere outside rainbowman - * @param {string} [options.img_url] - URL of the image to be displayed - * @param {Boolean} [options.click_close] - If true, destroys rainbowman on click outside + * @param {Object} [options] + * @param {string} [options.message] Message to be displayed on rainbowman card + * @param {string} [options.fadeout='medium'] Delay for rainbowman to disappear + * [options.fadeout='fast'] will make rainbowman dissapear quickly, + * [options.fadeout='medium'] and [options.fadeout='slow'] will wait + * little longer before disappearing (can be used when [options.message] + * is longer), + * [options.fadeout='no'] will keep rainbowman on screen until user clicks + * anywhere outside rainbowman + * @param {string} [options.img_url] URL of the image to be displayed + * @param {boolean} [options.click_close=true] If true, destroys rainbowman on + * click outside */ init: function (options) { this._super.apply(this, arguments); @@ -38,18 +51,6 @@ var RainbowMan = Widget.extend({ /** * @override */ - willStart: function () { - var def; - if (!qweb.has_template(this.template)) { - // we need to manually load the templates when the rainbon_man is used in - // the frontend, for example, it may be displayed at the end of a tour. - def = ajax.loadXML("/web/static/src/xml/rainbow_man.xml", qweb); - } - return $.when(this._super.apply(this, arguments), def); - }, - /** - * @override - */ start: function () { var self = this; if (this.options.click_close) { |
