[FIX] web_editor: do not focus or set an empty image

When editing the website, adding a gallery, choosing the grid mode
and then adding images, an extra, empty, image was
added to the grid, in the first position, making it looking weird
or at least not aligned.

This was due to the `start` method of the widget, which
is trying to focus the image in the images browser when
you double click on an image (in the big image building block
for instance) and set an image without url in the case
where `o.url` was undefined, and the url of one of the records
was also undefined.

opw-692205
This commit is contained in:
Denis Ledoux
2016-12-19 13:56:38 +01:00
parent 4e60d28d00
commit f616b2d20d
+3 -1
View File
@@ -299,7 +299,9 @@ var ImageDialog = Widget.extend({
self.display_attachments();
});
this.fetch_existing().then(function () {
self.set_image(_.find(self.records, function (record) { return record.url === o.url;}) || o);
if (o.url) {
self.set_image(_.find(self.records, function (record) { return record.url === o.url;}) || o);
}
});
return res;
},