[FIX] web_editor: snippet colorpicker option

When going over the colorpicker when no bg-* class was selected yet,
the bg-undefined class was added on the snippet.
Also, when clicking on the reset button, the bg-* class was removed
but the selected button in the colorpicker was not unselected.
This commit is contained in:
qsm-odoo
2016-05-24 17:49:14 +02:00
parent d35d8c3fca
commit ea2e0eea78
@@ -344,8 +344,11 @@ odoo.define('web_editor.snippets.options', function (require) {
self.$target.removeClass(self.classes).addClass('bg-' + $(this).data("color"));
})
.mouseleave(function () {
self.$target.removeClass(self.classes)
.addClass('bg-' + $colors.filter(".selected").data("color"));
self.$target.removeClass(self.classes);
var $selected = $colors.filter(".selected");
if ($selected.length) {
self.$target.addClass('bg-' + $selected.data("color"));
}
})
.click(function () {
$colors.removeClass("selected");
@@ -355,6 +358,7 @@ odoo.define('web_editor.snippets.options', function (require) {
this.$el.find('.note-color-reset').on('click', function () {
self.$target.removeClass(self.classes);
$colors.removeClass("selected");
});
}
});