From 4aab300070e65ca9bb0f7afe22150449baaad275 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 4 Apr 2017 15:04:12 +0200 Subject: [PATCH] [FIX] web_editor: allow to save unchanged icons with media dialog There was a bug with the icon edition when following these steps: - Open the Media dialog to edit an existing icon - Hit the "save" button in the dialog without choosing the icon - The edited icon disappears This happenned for icons whose original values were aliases of the related icon. Indeed, following these steps to edit an "fa-facebook-f" was leaving the icon unchanged as expected but doing it for a "fa-facebook" icon made the icon disappeared. This is because the last one is an alias of the first one and that the media dialog was ignoring aliasies when saving the original value. opw-725813 --- addons/web_editor/static/src/js/widgets.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js index 44b6b9502d1..6e7a6784351 100644 --- a/addons/web_editor/static/src/js/widgets.js +++ b/addons/web_editor/static/src/js/widgets.js @@ -637,9 +637,12 @@ var fontIconsDialog = Widget.extend({ }, renderElement: function () { // extract list of font (like awesome) from the cheatsheet. this.iconsParser = fontIcons; - this.icons = _.flatten(_.map(fontIcons, function (data) { + this.icons = _.flatten(_.map(fontIcons, function (data) { // TODO maybe useless now return data.icons; })); + this.alias = _.flatten(_.map(fontIcons, function (data) { + return data.alias; + })); this._super.apply(this, arguments); }, search: function (needle) { @@ -741,11 +744,8 @@ var fontIconsDialog = Widget.extend({ case '': continue; default: $(".font-icons-icon").removeClass("o_selected").filter("[data-alias*=',"+cls+",']").addClass("o_selected"); - for (var k=0; k