diff --git a/addons/website/static/src/scss/website.scss b/addons/website/static/src/scss/website.scss index ebb756d1a47..ffeac83c761 100644 --- a/addons/website/static/src/scss/website.scss +++ b/addons/website/static/src/scss/website.scss @@ -206,6 +206,18 @@ $-seen-urls: (); } } +// We don't want the area to be visible in edit mode when we edit the popup that +// is shared on all pages, otherwise the .o_editable area has a minimum height +// when it is focused. +#o_shared_blocks { + min-height: 0px; + height: 0px; + + &:empty { + display: none; + } +} + .navbar { .navbar-collapse { diff --git a/addons/website/static/src/snippets/s_popup/options.js b/addons/website/static/src/snippets/s_popup/options.js index 867de61bedc..277c510054a 100644 --- a/addons/website/static/src/snippets/s_popup/options.js +++ b/addons/website/static/src/snippets/s_popup/options.js @@ -95,14 +95,15 @@ options.registry.SnippetPopup = options.Class.extend({ //-------------------------------------------------------------------------- /** - * Moves the snippet in footer to be common to all pages - * or inside wrap to be on one page only + * Moves the snippet in #o_shared_blocks to be common to all pages or inside + * the first editable oe_structure in the main to be on current page only. * * @see this.selectClass for parameters */ moveBlock: function (previewMode, widgetValue, params) { - const containerEl = this.$target[0].ownerDocument.querySelector(widgetValue === 'moveToFooter' ? 'footer' : 'main'); - const whereEl = $(containerEl).find('.oe_structure:o_editable')[0]; + const selector = widgetValue === 'allPages' ? + '#o_shared_blocks' : 'main .oe_structure:o_editable'; + const whereEl = $(this.$target[0].ownerDocument).find(selector)[0]; const popupEl = this.$target[0].closest('.s_popup'); whereEl.prepend(popupEl); }, @@ -132,7 +133,7 @@ options.registry.SnippetPopup = options.Class.extend({ _computeWidgetState: function (methodName, params) { switch (methodName) { case 'moveBlock': - return this.$target.closest('footer').length ? 'moveToFooter' : 'moveToBody'; + return this.$target[0].closest('#o_shared_blocks') ? 'allPages' : 'currentPage'; } return this._super(...arguments); }, diff --git a/addons/website/views/snippets/s_popup.xml b/addons/website/views/snippets/s_popup.xml index 56d428b66cb..73215922fdf 100644 --- a/addons/website/views/snippets/s_popup.xml +++ b/addons/website/views/snippets/s_popup.xml @@ -58,8 +58,8 @@ days - This page - All pages + This page + All pages
+ + +