diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-04-04 15:04:12 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-04-07 17:46:07 +0200 |
| commit | 4aab300070e65ca9bb0f7afe22150449baaad275 (patch) | |
| tree | 66cc924843603fec4423c46ec99d98b84810887b /addons/web_editor/static/src | |
| parent | 8d65763f935dcc6483278a6aecd2039e41974773 (diff) | |
[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
Diffstat (limited to 'addons/web_editor/static/src')
| -rw-r--r-- | addons/web_editor/static/src/js/widgets.js | 12 |
1 files 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<this.icons.length; k++) { - if (this.icons.indexOf(cls) !== -1) { - this.$('#fa-icon').val(cls); - break; - } + if (this.alias.indexOf(cls) !== -1) { + this.$('#fa-icon').val(cls); } } } |
