[FIX] website: reorder selectors used for switching cookie banner layout

The cookie policy banner template includes nested selectors, such as
o_cookies_bar_text_policy within o_cookies_bar_text_secondary.
The process for switching the banner layout involves copying selectors
based on the order defined in CookiesBar::selectLayout()::selectorsToKeep.
However, a bug caused o_cookies_bar_text_policy to be copied before
o_cookies_bar_text_secondary, resulting in its content being overridden
by its parent content. The fix involves reordering the selectors so that
o_cookies_bar_text_secondary is copied before o_cookies_bar_text_policy.

opw-3302511

closes odoo/odoo#121324

X-original-commit: 720ae005bce261ce3b9e32dc8ade1f1d97f1aee1
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
VAN BOSSUYT Nicolas
2023-05-15 15:07:32 +02:00
parent b093fc9204
commit 8a8d4e7c59
@@ -2779,13 +2779,20 @@ options.registry.CookiesBar = options.registry.SnippetPopup.extend({
}));
const $content = this.$target.find('.modal-content');
// The order of selectors is significant since certain selectors may be
// nested within others, and we want to preserve the nested ones.
// For instance, in the case of '.o_cookies_bar_text_policy' nested
// inside '.o_cookies_bar_text_secondary', the parent selector should be
// copied first, followed by the child selector to ensure that the
// content of the nested selector is not overwritten.
const selectorsToKeep = [
'.o_cookies_bar_text_button',
'.o_cookies_bar_text_button_essential',
'.o_cookies_bar_text_policy',
'.o_cookies_bar_text_title',
'.o_cookies_bar_text_primary',
'.o_cookies_bar_text_secondary',
'.o_cookies_bar_text_policy'
];
if (this.$savedSelectors === undefined) {