[FIX] website: enable the "all pages" option of the popup snippet
This commit enables the use of the option "All pages" when using a popup snippet. Steps to reproduce the bug: - Drag & drop a popup snippet. - On its option in the right panel, there is "Show On" set by default to "This page". - Try to modify this option and select "All pages". Bug observed: The "All pages" option can not be selected and the "Show On" stays on "This page". This commit has been done because since the version 16.0, the footer is on an iframe [1]. Because of that, the program does not have a direct access to the footer. This is why it is needed to first access the top-level document before using the querySelector. [1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b task-2983822 closes odoo/odoo#107236 X-original-commit: f469385dcfcbd9290c3522422f9e10600bb60b76 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -91,8 +91,10 @@ options.registry.SnippetPopup = options.Class.extend({
|
||||
* @see this.selectClass for parameters
|
||||
*/
|
||||
moveBlock: function (previewMode, widgetValue, params) {
|
||||
const $container = $(widgetValue === 'moveToFooter' ? 'footer' : 'main');
|
||||
this.$target.closest('.s_popup').prependTo($container.find('.oe_structure:o_editable').first());
|
||||
const containerEl = this.$target[0].ownerDocument.querySelector(widgetValue === 'moveToFooter' ? 'footer' : 'main');
|
||||
const whereEl = $(containerEl).find('.oe_structure:o_editable')[0];
|
||||
const popupEl = this.$target[0].closest('.s_popup');
|
||||
whereEl.prepend(popupEl);
|
||||
},
|
||||
/**
|
||||
* @see this.selectClass for parameters
|
||||
|
||||
Reference in New Issue
Block a user