diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-11-29 14:39:42 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-01-16 20:49:19 +0100 |
| commit | 9bee25a9df65f657fef0f2f32a7ad823fdc7d4e1 (patch) | |
| tree | fa9b822f56409bf4006599294e6ce0742cbcd165 /addons/web | |
| parent | de27eaa97161abb06c717a36b7ed68d6f36e4e73 (diff) | |
[REF] account,web(_tour): close rainbowman on click
This rev. makes the Rainbowman stop listening to event
'clear_uncommitted_changes' on core.bus, as this event is about to
be removed (in a next commit). It was using it to destroy itself
when such an event was triggered (basically, when the current view
was left).
Instead, we removed the option 'click_close' as, when set to true,
which was the default, the rainbowman was destroyed as soon as the
user clicked outside the raibowman.
Diffstat (limited to 'addons/web')
| -rw-r--r-- | addons/web/static/src/js/widgets/rainbow_man.js | 16 | ||||
| -rw-r--r-- | addons/web/static/tests/widgets/rainbow_man_tests.js | 1 |
2 files changed, 5 insertions, 12 deletions
diff --git a/addons/web/static/src/js/widgets/rainbow_man.js b/addons/web/static/src/js/widgets/rainbow_man.js index 16d4d9a1e3d..e46201584bc 100644 --- a/addons/web/static/src/js/widgets/rainbow_man.js +++ b/addons/web/static/src/js/widgets/rainbow_man.js @@ -33,8 +33,6 @@ var RainbowMan = Widget.extend({ * [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); @@ -43,23 +41,19 @@ var RainbowMan = Widget.extend({ fadeout: 'medium', img_url: '/web/static/src/img/smile.svg', message: _t('Well Done!'), - click_close: true, }); this.delay = rainbowDelay[this.options.fadeout]; - core.bus.on('clear_uncommitted_changes', this, this.destroy); }, /** * @override */ start: function () { var self = this; - if (this.options.click_close) { - core.bus.on('click', this, function (ev) { - if (ev.originalEvent && ev.target.className.indexOf('o_reward') === -1) { - this.destroy(); - } - }); - } + core.bus.on('click', this, function (ev) { + if (ev.originalEvent && ev.target.className.indexOf('o_reward') === -1) { + this.destroy(); + } + }); if (this.delay) { setTimeout(function () { self.$el.addClass('o_reward_fading'); diff --git a/addons/web/static/tests/widgets/rainbow_man_tests.js b/addons/web/static/tests/widgets/rainbow_man_tests.js index b9ccef662c9..ad265416f3c 100644 --- a/addons/web/static/tests/widgets/rainbow_man_tests.js +++ b/addons/web/static/tests/widgets/rainbow_man_tests.js @@ -9,7 +9,6 @@ QUnit.module('RainbowMan', { beforeEach: function () { this.data = { message: 'Congrats!', - click_close: false }; }, }, function () { |
