[FIX] website, *: no theme color suggestions during theme colors edition

* web_editor

Part of https://github.com/odoo/odoo/pull/38959
task-2066614
This commit is contained in:
qsm-odoo
2019-11-18 09:56:40 +00:00
parent ea994b0cbb
commit c879ac723b
2 changed files with 6 additions and 0 deletions
@@ -31,6 +31,7 @@ const ColorPaletteWidget = Widget.extend({
* @param {string} [options.colorPrefix='bg-'] Used for the class based colors (theme).
* @param {boolean} [options.resetButton=true] Whether to display or not the reset button.
* @param {string[]} [options.excluded=[]] Sections not to display.
* @param {string[]} [options.excludeSectionOf] Extra section to exclude: the one containing the named color.
* @param {JQuery} [options.$editable=$()] Editable content from which the custom colors are retrieved.
*/
init: function (parent, options) {
@@ -42,6 +43,7 @@ const ColorPaletteWidget = Widget.extend({
colorPrefix: 'bg-',
resetButton: true,
excluded: [],
excludeSectionOf: null,
$editable: $(),
}, options || {});
@@ -86,6 +88,9 @@ const ColorPaletteWidget = Widget.extend({
_.each(this.options.excluded, function (exc) {
$wrapper.find('[data-name="' + exc + '"]').remove();
});
if (this.options.excludeSectionOf) {
$wrapper.find('[data-name]:has([data-color="' + this.options.excludeSectionOf + '"])').remove();
}
// Render common colors
if (!this.options.excluded.includes('common')) {
@@ -519,6 +519,7 @@ var ThemeCustomizeDialog = Dialog.extend({
resetButton: false,
defaultColor: $color.css('background-color'),
excluded: ['transparent_grayscale'],
excludeSectionOf: colorName,
});
var chosenColor = undefined;
colorpicker.on('color_picked custom_color_picked', self, function (ev) {