[FIX] website: fix header overlay with sidebar header

This commit fixes two bugs with the sidebar header.

Steps to reproduce the 1st bug:

- Go to "/shop" and edit the page.
- Click on the header.
- Open the header selector.
- Choose the "sidebar header".
- Bug: infinite loader (or traceback from V16).

Steps to reproduce the 2nd bug:

- Go to "/contactus" and edit the page.
- Click on the header.
- Change the "Header Position" option to "over the content".
- Save the page.
- Go to the homepage and edit the page.
- Click on the header.
- Open the header selector.
- Choose the "sidebar header".
- Save the page.
- Go to /contactus.
- Bug: the "sidebar" header is broken on the "/contactus" page.

The first bug was caused by triggering the deactivation of the "Overlay"
header from a location other than a website.page (in this case, the
"/shop" page in the steps to reproduce). In this place, the "Overlay"
header option isn't available.

However, while trying to fix this, we noticed the second bug => When we
activate the "sidebar" header (which is a general option for all pages),
we were deactivating the "Overlay" header only on the current page (this
option is specific to the page). It was done since this commit [1].
This doesn't make sense because the "Overlay" header should be
deactivated on all pages, not just the current one.

To address this in the simplest way, we modified the CSS so that the
"Overlay" header doesn't have an impact when the sidebar header is
activated. Without this change, we would have needed to add an RPC to
remove the "Overlay" header on all pages, which wouldn't have been worth
it.

[1]: https://github.com/odoo/odoo/commit/618fd49642310c7b97ef3b9e6c01f8f691c7b12f

task-3454161

closes odoo/odoo#139955

X-original-commit: b27279492fea98f2cd6bfba962bfd570e464d361
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
This commit is contained in:
Benjamin Vray
2023-10-27 13:02:23 +00:00
parent 43640ceb1c
commit b5f43b22d4
2 changed files with 2 additions and 21 deletions
@@ -2300,26 +2300,7 @@ options.registry.WebsiteLevelColor = options.Class.extend({
});
options.registry.HeaderLayout = options.registry.WebsiteLevelColor.extend({
/**
* @overide
*/
async customizeWebsiteViews(previewMode, widgetValue, params) {
const _super = this._super.bind(this);
if (params.name === 'header_sidebar_opt') {
// When the user selects sidebar as header, make sure that the
// header position is regular.
await new Promise(resolve => {
this.trigger_up('action_demand', {
actionName: 'toggle_page_option',
params: [{name: 'header_overlay', value: false}],
onSuccess: () => resolve(),
});
});
}
return _super(...arguments);
}
// TODO: to remove in master, it is only kept for the stable versions.
});
options.registry.HeaderElements = options.Class.extend({
+1 -1
View File
@@ -1299,7 +1299,7 @@ header {
}
#wrapwrap.o_header_overlay {
> header:not(.o_header_affixed):not(.o_top_menu_collapse_shown) {
> header:not(.o_header_affixed):not(.o_top_menu_collapse_shown):not(.o_header_sidebar) {
@include o-position-absolute(0, 0, auto, 0);
z-index: 1000;