summaryrefslogtreecommitdiff
path: root/addons/web_editor/static
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-11-14 13:49:38 +0100
committerqsm-odoo <qsm@odoo.com>2017-11-15 10:59:49 +0100
commit4e32a23d969d6ba1b54836bfc09be1eb6ee4f3c0 (patch)
tree7935ba03b4baa3496e05ad502a8e15f87a46043f /addons/web_editor/static
parentdfa554ba7d9b4a5856cd96ce926bb01783ef4410 (diff)
[FIX] web_editor: restore selected images display
In the media dialog, when an image is selected, it has a colored border to indicate it. Commit https://github.com/odoo/odoo/commit/e011d58bee140411ccfb1ef9115dddc090d573c3 made changes, part of them designed to "Improve the image dialog to be able to select/unselect". While this commit was indeed doing that, it was also breaking stuff: when selecting image(s) then performing a search, the colored border disappeared while the images were in fact still selected. Fortunately, this stuff breaking is only due to code modification that was made for no reason (so reverting part of the commit is enough to restore the features while keeping the commit's improvements).
Diffstat (limited to 'addons/web_editor/static')
-rw-r--r--addons/web_editor/static/src/js/widgets/widgets.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js
index f8626e33390..8214754cd6b 100644
--- a/addons/web_editor/static/src/js/widgets/widgets.js
+++ b/addons/web_editor/static/src/js/widgets/widgets.js
@@ -229,7 +229,6 @@ var ImageDialog = Widget.extend({
this.push(attachment);
this.$('input.url').val('');
this.search();
- this.images = [];
},
form_submit: function (event) {
var self = this;
@@ -342,24 +341,20 @@ var ImageDialog = Widget.extend({
},
select_existing: function (e) {
var $img = $(e.currentTarget);
- if (!this.options.select_images) {
- this.$('.o_existing_attachment_cell.o_selected').removeClass("o_selected");
- $img.closest('.o_existing_attachment_cell').addClass('o_selected');
- } else {
- $img.closest('.o_existing_attachment_cell').toggleClass('o_selected');
- }
var attachment = _.find(this.records, function (record) { return record.id === $img.data('id'); });
this.push(attachment);
this.selected_existing();
},
selected_existing: function () {
var self = this;
+ this.$('.o_existing_attachment_cell.o_selected').removeClass("o_selected");
var $select = this.$('.o_existing_attachment_cell [data-src]').filter(function () {
var $img = $(this);
return !!_.find(self.images, function (v) {
return (v.url === $img.data("src") || ($img.data("url") && v.url === $img.data("url")) || v.id === $img.data("id"));
});
});
+ $select.closest('.o_existing_attachment_cell').addClass("o_selected");
return $select;
},
try_remove: function (e) {