diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 36321199aa5..98fd7ba4e8a 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -405,6 +405,9 @@ var SnippetEditor = Widget.extend({ if (this.$target.parent('.row').length) { return _t("Column"); } + if (this.$target.is('#wrapwrap > main')) { + return _t("Page Options"); + } return _t("Block"); }, /** diff --git a/addons/website/static/src/js/editor/snippets.editor.js b/addons/website/static/src/js/editor/snippets.editor.js index ab0e3b83791..f8bd3da2ae7 100644 --- a/addons/website/static/src/js/editor/snippets.editor.js +++ b/addons/website/static/src/js/editor/snippets.editor.js @@ -53,6 +53,43 @@ weSnippetEditor.SnippetsMenu.include({ document.body.classList.remove('o_animated_text_highlighted'); }, + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * Adds the "customize_show" templates to the options page of the editor + * panel. + * + * @override + */ + async loadSnippets() { + const viewName = $(this.options.wysiwyg.odooEditor.document.documentElement).data('view-xmlid'); + const snippets = await this._super(...arguments); + if (!viewName) { + return snippets; + } + const $snippets = $(snippets); + return this._rpc({ + route: '/website/get_switchable_related_views', + params: { + key: viewName, + }, + }).then(function (result) { + _.each(result, view => { + $snippets.siblings('#snippet_options').append($(` +
+ +
+ `)); + }); + return $('
').append($snippets).html(); + }); + }, + //-------------------------------------------------------------------------- // Private //--------------------------------------------------------------------------