From f34fae25d169f66092ed0fafb1edea0c1ca82c46 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Fri, 11 Oct 2019 09:47:48 +0000 Subject: [PATCH] [FIX] web_editor, *: expose access to all snippet options UI * website_form To support old theme options, a hack had to be made to allow access to left panel UI. This will be improved in master. Part of https://github.com/odoo/odoo/pull/38495 task-2083198 X-original-commit: 5ac6a7a5dbd2af1190d0d027d0239dd1cfc257b0 --- addons/web_editor/static/src/js/editor/snippets.editor.js | 4 ++++ addons/website_form/static/src/js/website_form_editor.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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 775165354ea..987ebf9400e 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -359,6 +359,10 @@ var SnippetEditor = Widget.extend({ $optionsSection.on('click', '.oe_snippet_remove', this._onRemoveClick.bind(this)); this._customize$Elements.push($optionsSection); + // TODO get rid of this when possible (made as a fix to support old + // theme options) + this.$el.data('$optionsSection', $optionsSection); + var i = 0; var defs = _.map(this.templateOptions, val => { if (!val.selector.is(this.$target)) { diff --git a/addons/website_form/static/src/js/website_form_editor.js b/addons/website_form/static/src/js/website_form_editor.js index 355b2688b2a..fad1472820e 100644 --- a/addons/website_form/static/src/js/website_form_editor.js +++ b/addons/website_form/static/src/js/website_form_editor.js @@ -530,8 +530,8 @@ odoo.define('website_form_editor', function (require) { disable_button: function (button_name, message) { // TODO refactor in master var className = 'oe_snippet_' + button_name; - this.$overlay.on('click', '.' + className, this.prevent_button); - var $button = this.$overlay.find('.' + className); + this.$overlay.add(this.$overlay.data('$optionsSection')).on('click', '.' + className, this.prevent_button); + var $button = this.$overlay.add(this.$overlay.data('$optionsSection')).find('.' + className); $button.attr('title', message).tooltip({delay: 0}); $button.removeClass(className); // Disable the functionnality },