diff --git a/addons/website/i18n/website.pot b/addons/website/i18n/website.pot index 20d7991f896..d20061741b9 100644 --- a/addons/website/i18n/website.pot +++ b/addons/website/i18n/website.pot @@ -6104,6 +6104,13 @@ msgstr "" #. odoo-javascript #: code:addons/website/static/src/js/editor/snippets.options.js:0 #, python-format +msgid "Mobile Alignment" +msgstr "" + +#. module: website +#. openerp-web +#: code:addons/website/static/src/js/editor/snippets.options.js:0 +#, python-format msgid "Mobile menu" msgstr "" diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js index 8df8c26b71c..61cb0b83315 100644 --- a/addons/website/static/src/js/editor/snippets.options.js +++ b/addons/website/static/src/js/editor/snippets.options.js @@ -2226,6 +2226,24 @@ options.registry.HeaderNavbar = options.Class.extend({ : _t("Mobile menu"); }, + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * @private + */ + async updateUI() { + await this._super(...arguments); + // For all header templates except those in the following array, change + // the label of the option to "Mobile Alignment" (instead of + // "Alignment") because it only impacts the mobile view. + if (!["'default'", "'hamburger'", "'sidebar'"].includes(weUtils.getCSSVariableValue('header-template'))) { + const alignmentOptionTitleEl = this.el.querySelector('[data-name="header_alignment_opt"] we-title'); + alignmentOptionTitleEl.textContent = _t("Mobile Alignment"); + } + }, + //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- @@ -2246,6 +2264,14 @@ options.registry.HeaderNavbar = options.Class.extend({ return !weUtils.getCSSVariableValue('header-template').includes('hamburger'); } } + if (widgetName === 'header_alignment_opt') { + if (!this.$target[0].querySelector('.o_offcanvas_menu_toggler')) { + // If mobile menu is "Default", hides the alignment option for + // "hamburger full" and "magazine" header templates. + return !["'hamburger-full'", "'magazine'"].includes(weUtils.getCSSVariableValue('header-template')); + } + return true; + } return this._super(...arguments); }, }); diff --git a/addons/website/static/src/scss/website.scss b/addons/website/static/src/scss/website.scss index 62ec3397f5c..e214486920a 100644 --- a/addons/website/static/src/scss/website.scss +++ b/addons/website/static/src/scss/website.scss @@ -915,14 +915,17 @@ header { #top_menu_container { flex-direction: inherit; } - @if $-hamburger-center { - .collapsing, .show { - #top_menu { - @if not $-off-canvas-hamburger { + + .collapsing, .show { + #top_menu { + @if $-hamburger-center { + @if not $-off-canvas-hamburger and not o-website-value('header-template') == 'magazine' { padding-top: 15vh; padding-bottom: 15vh; } text-align: center !important; + } @else if $-hamburger-right { + text-align: right; } } } @@ -949,11 +952,8 @@ header { #top_menu_collapse { &.collapsing, &.show { - // Note: position relatively to the header instead of the viewport - // because fixed position cannot work inside an element whose CSS - // transform is different to none, which the header element is - // because of header effects. @include o-position-absolute(0, 0, 0, 0); + position: fixed; z-index: $zindex-sticky; height: 100vh; max-height: 100vh; @@ -996,6 +996,7 @@ header { @if $-hamburger-center { width: 100%; max-width: none; + text-align: center !important; } @else { max-width: 560px; text-align: left !important; @@ -1061,6 +1062,13 @@ header { display: none; } } + @if o-website-value('header-template') == 'vertical' { + .oe_structure_solo { + // Hide the "oe_structure_solo" because it is outside the + // menu when the off-canvas menu is open. + display: none; + } + } } &.collapsing #top_menu { @if $-hamburger-center { diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 3c973c0a758..4aaaebb54a8 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -1257,7 +1257,7 @@