diff options
| author | Vincent Schippefilt <vsc@odoo.com> | 2019-03-06 14:02:33 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-03-06 20:07:17 +0100 |
| commit | 226a6a9e677b1ebded9240e181cc2ea83fa49d72 (patch) | |
| tree | db1caaa11b9905589031b10580db28a5486b2b20 /addons/website/static/src/js/menu/customize.js | |
| parent | c39033bc1cff578626b6925ed542cfc8f709e15c (diff) | |
[REF] website: adapt code after jQuery update
Part of task 1896658
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Co-authored-by: svs-odoo <svs@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
Diffstat (limited to 'addons/website/static/src/js/menu/customize.js')
| -rw-r--r-- | addons/website/static/src/js/menu/customize.js | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/addons/website/static/src/js/menu/customize.js b/addons/website/static/src/js/menu/customize.js index aced336de2c..59c4e865242 100644 --- a/addons/website/static/src/js/menu/customize.js +++ b/addons/website/static/src/js/menu/customize.js @@ -45,7 +45,7 @@ var CustomizeMenu = Widget.extend({ * * @private * @param {integer} viewID - * @returns {Deferred} + * @returns {Promise} * Unresolved if the customization succeeded as the page will be * reloaded. * Rejected otherwise. @@ -57,7 +57,7 @@ var CustomizeMenu = Widget.extend({ args: [[viewID]], }).then(function () { window.location.reload(); - return $.Deferred(); + return new Promise(function () {}); }); }, /** @@ -65,11 +65,11 @@ var CustomizeMenu = Widget.extend({ * the current page and shows them as switchable elements in the menu. * * @private - * @return {Deferred} + * @return {Promise} */ _loadCustomizeOptions: function () { if (this.__customizeOptionsLoaded) { - return $.when(); + return Promise.resolve(); } this.__customizeOptionsLoaded = true; @@ -169,18 +169,20 @@ var AceEditorMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({ * which are used by the current page. * * @private - * @returns {Deferred} + * @returns {Promise} */ _launchAce: function () { - var def = $.Deferred(); - this.trigger_up('action_demand', { - actionName: 'close_all_widgets', - onSuccess: def.resolve.bind(def), + var self = this; + var prom = new Promise(function (resolve, reject) { + self.trigger_up('action_demand', { + actionName: 'close_all_widgets', + onSuccess: resolve, + }); }); - return def.then((function () { - if (this.globalEditor) { - this.globalEditor.do_show(); - return $.when(); + prom.then(function () { + if (self.globalEditor) { + self.globalEditor.do_show(); + return Promise.resolve(); } else { var currentHash = window.location.hash; var indexOfView = currentHash.indexOf("?res="); @@ -193,16 +195,18 @@ var AceEditorMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({ } } - this.globalEditor = new WebsiteAceEditor(this, $(document.documentElement).data('view-xmlid'), { + self.globalEditor = new WebsiteAceEditor(self, $(document.documentElement).data('view-xmlid'), { initialResID: initialResID, defaultBundlesRestriction: [ "web.assets_frontend", "website.assets_frontend", ], }); - return this.globalEditor.appendTo(document.body); + return self.globalEditor.appendTo(document.body); } - }).bind(this)); + }); + + return prom; }, }); |
