summaryrefslogtreecommitdiff
path: root/addons/website_mass_mailing/static
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2019-12-09 11:02:43 +0000
committerqsm-odoo <qsm@odoo.com>2019-12-09 12:48:02 +0000
commit2521578033464d50690a284cfa63519d8dd3de86 (patch)
tree50ff8ed5d9cc78ba1abe04d8e68c0047f82439d0 /addons/website_mass_mailing/static
parent255be177e9e281d3b71788ed125aaa6ab507783a (diff)
[REF] website, *: automatically refresh widgets on option change
* website, website_mass_mailing Now, when any option method is called (editor left panel), the widgets related to the targeted DOM is automatically updated. This is possible to disable for a specific widget with `data-no-widget-refresh="true"`. This commit also makes the `_refreshPublicWidget` method better handle its async component: it is now "fully async" so the caller should wait for its resolution before executing some other related code.
Diffstat (limited to 'addons/website_mass_mailing/static')
-rw-r--r--addons/website_mass_mailing/static/src/js/website_mass_mailing.editor.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/addons/website_mass_mailing/static/src/js/website_mass_mailing.editor.js b/addons/website_mass_mailing/static/src/js/website_mass_mailing.editor.js
index ca10b5586a0..83957980e8a 100644
--- a/addons/website_mass_mailing/static/src/js/website_mass_mailing.editor.js
+++ b/addons/website_mass_mailing/static/src/js/website_mass_mailing.editor.js
@@ -70,11 +70,7 @@ options.registry.newsletter_popup = options.registry.mailing_list_subscribe.exte
// So that the snippet is not enabled again by the editor
ev.stopPropagation();
self.$target.data('quick-open', true);
- options.onSuccess(new Promise(resolve => {
- self._refreshPublicWidgets(self.$target, {
- onSuccess: () => resolve(),
- });
- }));
+ options.onSuccess(self._refreshPublicWidgets());
});
this.$target.on('shown.bs.modal.newsletter_popup_option hide.bs.modal.newsletter_popup_option', function () {
self.$target.closest('.o_editable').trigger('content_changed');
@@ -118,7 +114,7 @@ options.registry.newsletter_popup = options.registry.mailing_list_subscribe.exte
return this._super.apply(this, arguments).then(function () {
self.$target.data('quick-open', true);
self.$target.removeData('content');
- self._refreshPublicWidgets();
+ return self._refreshPublicWidgets();
});
},
});