[FIX] web_editor: image name

Add the image name in the website for SEO purpose. This is a backport
of:
88a5d9a000
886c07dabb
152e3f8686

opw-1880472
This commit is contained in:
Nicolas Martinelli
2018-09-05 09:42:10 +02:00
committed by Nicolas Martinelli
parent 229c119999
commit e673484b35
+2 -2
View File
@@ -390,7 +390,7 @@ var ImageDialog = Widget.extend({
$form.find('.well > span').remove();
$form.find('.well > div').show();
_.each(attachments, function (record) {
record.src = record.url || '/web/image/' + record.id;
record.src = record.url || _.str.sprintf('/web/image/%s/%s', record.id, encodeURI(record.name)); // Name is added for SEO purposes
record.is_document = !(/gif|jpe|jpg|png/.test(record.mimetype));
});
if (error || !attachments.length) {
@@ -447,7 +447,7 @@ var ImageDialog = Widget.extend({
return (r.url || r.id);
});
_.each(this.records, function (record) {
record.src = record.url || '/web/image/' + record.id;
record.src = record.url || _.str.sprintf('/web/image/%s/%s', record.id, encodeURI(record.name)); // Name is added for SEO purposes
record.is_document = !(/gif|jpe|jpg|png/.test(record.mimetype));
});
this.display_attachments();