From 38b5c759f3ade54aaaa620f2b5ab23c11e9cc71e Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Thu, 2 Jan 2020 10:59:01 +0000 Subject: [PATCH] [FIX] website: fix cover properties not saving properly In 2cc8316c669, the cover properties snippet option was refactored to using a single data attribute per select instead of repeating it on every button inside of it. After selecting an option, the corresponding data attribute would be set on the cover container by finding the currently active button and copying its select class attribute. However, because of an oversight, instead of finding the currently active button inside the select, the option would find any active item inside of the select, and because the select is always open when a button inside is clicked, the first active item inside of the select is its toggler. This commit fixes that by increasing the specificity of the selector that finds the active button to only find buttons, and not the select-menu toggler. closes odoo/odoo#42567 Signed-off-by: Quentin Smetz (qsm) --- addons/website/static/src/js/editor/snippets.options.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js index 6efab4b91e7..cd657db259c 100644 --- a/addons/website/static/src/js/editor/snippets.options.js +++ b/addons/website/static/src/js/editor/snippets.options.js @@ -1162,9 +1162,9 @@ options.registry.CoverProperties = options.Class.extend({ await this._super(...arguments); // Update saving dataset - this.$target[0].dataset.coverClass = this.$el.find('[data-cover-opt-name="size"] .active').data('selectClass') || ''; - this.$target[0].dataset.textSizeClass = this.$el.find('[data-cover-opt-name="text_size"] .active').data('selectClass') || ''; - this.$target[0].dataset.textAlignClass = this.$el.find('[data-cover-opt-name="text_align"] .active').data('selectClass') || ''; + this.$target[0].dataset.coverClass = this.$el.find('[data-cover-opt-name="size"] we-button.active').data('selectClass') || ''; + this.$target[0].dataset.textSizeClass = this.$el.find('[data-cover-opt-name="text_size"] we-button.active').data('selectClass') || ''; + this.$target[0].dataset.textAlignClass = this.$el.find('[data-cover-opt-name="text_align"] we-button.active').data('selectClass') || ''; this.$target[0].dataset.filterValue = this.$filterValueOpts.filter('.active').data('filterValue') || 0.0; this.$target[0].dataset.filterColor = this.$filterColorOpts.filter('.active').data('filterColor') || ''; },