diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-06-09 08:29:19 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-06-09 10:52:27 +0000 |
| commit | 42a424db20eaf51f3afc11cefeb0c1f9afcfe66d (patch) | |
| tree | e4a36dd7f716b9de405e9db97b99fdc0c7ede963 /addons | |
| parent | 117552f09764685b4efccf1bf910fc27f8741d9d (diff) | |
[FIX] website: only open s_popup snippet once (outside of editor)
When the snippet was configured to be opened "on exit", it was opened
on every screen exit until the page was reloaded/left.
Part of https://github.com/odoo/odoo/pull/52663
closes odoo/odoo#52686
X-original-commit: e07a25c40dc48ff36150f5a10461d95a86e95804
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/website/static/src/snippets/s_popup/000.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/website/static/src/snippets/s_popup/000.js b/addons/website/static/src/snippets/s_popup/000.js index 16820dcc988..a16b711b290 100644 --- a/addons/website/static/src/snippets/s_popup/000.js +++ b/addons/website/static/src/snippets/s_popup/000.js @@ -15,7 +15,8 @@ const PopupWidget = publicWidget.Widget.extend({ * @override */ start: function () { - if (!utils.get_cookie(this.$el.attr('id'))) { + this._popupAlreadyShown = !!utils.get_cookie(this.$el.attr('id')); + if (!this._popupAlreadyShown) { this._bindPopup(); } return this._super(...arguments); @@ -66,6 +67,9 @@ const PopupWidget = publicWidget.Widget.extend({ * @private */ _showPopup: function () { + if (this._popupAlreadyShown) { + return; + } this.$target.find('.s_popup_main').removeClass('d-none'); }, @@ -79,6 +83,7 @@ const PopupWidget = publicWidget.Widget.extend({ _onCloseClick: function () { const nbDays = this.$el.find('.s_popup_main').data('consentsDuration'); utils.set_cookie(this.$el.attr('id'), true, nbDays * 24 * 60 * 60); + this._popupAlreadyShown = true; this._hidePopup(); }, }); |
