[FIX] website: fix cover properties not saving properly

In 2cc8316c66, 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) <qsm@odoo.com>
This commit is contained in:
Samuel Degueldre
2020-01-02 11:08:46 +00:00
parent 989a78b3fc
commit 38b5c759f3
@@ -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') || '';
},