From 89f13a75c4e98b4a49f0c11c333a06c182fc31d8 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 8 Jun 2022 08:58:17 +0000 Subject: [PATCH] [FIX] website: prevent the sidebar from being over the content With this commit, users can no longer have headers that have the sidebar template and the over the content option at the same time. Steps to reproduce the problem: - Edit a website - Edit the navbar - Set Header Position to Over the Content - Change the navbar template to Sidebar The navbar is not displayed properly and there is a margin on the left that should not be there. task-2877421 closes odoo/odoo#95463 X-original-commit: 618fd49642310c7b97ef3b9e6c01f8f691c7b12f Signed-off-by: Quentin Smetz (qsm) --- .../static/src/js/editor/snippets.options.js | 23 +++++++++++++++++++ addons/website/views/snippets/snippets.xml | 5 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js index 0babf937e95..bd719db44f4 100644 --- a/addons/website/static/src/js/editor/snippets.options.js +++ b/addons/website/static/src/js/editor/snippets.options.js @@ -1980,6 +1980,29 @@ 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); + } +}); + options.registry.HeaderNavbar = options.Class.extend({ /** * Particular case: we want the option to be associated on the header navbar diff --git a/addons/website/views/snippets/snippets.xml b/addons/website/views/snippets/snippets.xml index b76108c3d40..108f63eb4b9 100644 --- a/addons/website/views/snippets/snippets.xml +++ b/addons/website/views/snippets/snippets.xml @@ -587,7 +587,7 @@ data-selector="[data-oe-expression='res_company.partner_id']" data-no-check="true"/> -
@@ -754,7 +754,8 @@
- + Over The Content Regular