[IMP] web_editor: add image filename at the end of URLs
When an image is added thanks to the media dialog, the URL that is used
was '/web/image/<id-of-the-attachment>'. Now the name of the image will
be added for SEO purposes ('/web/image/<id-of-the-attachment>/<name>').
Also protect URLs with quotes to allow spaces.
This commit is contained in:
@@ -833,7 +833,7 @@ registry.background = SnippetOption.extend({
|
||||
*/
|
||||
background: function (previewMode, value, $li) {
|
||||
if (value && value.length) {
|
||||
this.$target.css('background-image', 'url(' + value + ')');
|
||||
this.$target.css('background-image', 'url(\'' + value + '\')');
|
||||
this.$target.addClass('oe_img_bg');
|
||||
} else {
|
||||
this.$target.css('background-image', '');
|
||||
|
||||
@@ -306,7 +306,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, record.name); // Name is added for SEO purposes
|
||||
record.is_document = !(/gif|jpe|jpg|png/.test(record.mimetype));
|
||||
});
|
||||
this.display_attachments();
|
||||
|
||||
Reference in New Issue
Block a user