[FIX] website_sale: fix text color preview of ribbons

Before this commit, the text color preview of the ribbons in the
ribbon selector was wrong. But also, if we selected another ribbon
just after changing the text color of a ribbon. This color was applied
to the selected ribbon.

task-2501515

X-original-commit: 19252137588b30a69ce57f0248a504f7e929b98e
Part-of: odoo/odoo#77412
This commit is contained in:
Benjamin Vray
2021-09-29 15:56:34 +00:00
parent 96f4b014bb
commit 5afaeef864
@@ -447,7 +447,7 @@ options.registry.WebsiteSaleProductsItem = options.Class.extend({
$ribbons.removeClass(htmlClasses);
$ribbons.addClass(ribbon.html_class || '');
$ribbons.css('color', ribbon.text_color);
$ribbons.css('color', ribbon.text_color || '');
$ribbons.css('background-color', ribbon.bg_color || '');
if (!this.ribbons[widgetValue]) {
@@ -605,7 +605,7 @@ options.registry.WebsiteSaleProductsItem = options.Class.extend({
colorClasses,
isTag: /o_tag_(left|right)/.test(ribbon.html_class),
isLeft: /o_(tag|ribbon)_left/.test(ribbon.html_class),
textColor: ribbon.text_color || colorClasses ? 'currentColor' : defaultTextColor,
textColor: ribbon.text_color || (colorClasses ? 'currentColor' : defaultTextColor),
}));
});
},