[FIX] web_editor: restore link dialog preview

By default, all btn colors are suggested in the link dialog (alpha,
beta, gamma, delta, epsilon, link, primary, secondary, success, info,
warning and danger). In lots of themes (and the default one), primary
= alpha and secondary = beta, which led to having two suggestion with
the same apparent color.

A new system was introduced to automatically remove the duplicates...
but this system also removed the button preview as it considered it to
be a duplicate.

This commit also adapts the preview to BS4.

task-1878245
This commit is contained in:
qsm-odoo
2018-09-12 10:56:46 +02:00
parent 0cbf638730
commit 39a441e902
@@ -1461,7 +1461,7 @@ var LinkDialog = Dialog.extend({
// and secondary = beta for example but this may depend on the theme)
this.opened().then(function () {
var colors = [];
_.each(self.$('.o_btn_preview'), function (btn) {
_.each(self.$('.o_btn_preview.o_link_dialog_color_item'), function (btn) {
var $btn = $(btn);
var color = $btn.css('background-color');
if (_.contains(colors, color)) {
@@ -1521,7 +1521,7 @@ var LinkDialog = Dialog.extend({
$preview.attr({
target: data.isNewWindow ? '_blank' : '',
href: data.url && data.url.length ? data.url : '#',
class: data.classes.replace(/pull-\w+/, '') + ' o_btn_preview',
class: data.classes.replace(/float-\w+/, '') + ' o_btn_preview',
}).html((data.label && data.label.length) ? data.label : data.url);
},
/**