summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2018-01-25 13:33:19 +0100
committerqsm-odoo <qsm@odoo.com>2018-01-25 13:56:29 +0100
commitf79b00c3b71e02f73537cb17285a6902fc0906b5 (patch)
treee90847829700bc6dd9080be5cee3606d9a6b850f
parent461bf2331d65f072a004ca57fa706744110682ba (diff)
[FIX] portal, web_editor: responsive images but with inline display
Commit https://github.com/odoo/odoo/commit/abde8bddf8ec45cf12aab59e95c330321158cfba made a small change to make all images responsive when they are added with the editor. This had however the side effect of making them go to a new line which may not be what we want.
-rw-r--r--addons/portal/static/src/less/portal.less4
-rw-r--r--addons/web_editor/static/src/js/widgets/widgets.js4
2 files changed, 6 insertions, 2 deletions
diff --git a/addons/portal/static/src/less/portal.less b/addons/portal/static/src/less/portal.less
index 2dc8fa83c84..e6344b3d5d9 100644
--- a/addons/portal/static/src/less/portal.less
+++ b/addons/portal/static/src/less/portal.less
@@ -152,6 +152,10 @@ img, .media_iframe_video, .o_image {
margin-right: @grid-gutter-width / 2;
}
}
+img {
+ // Make all images responsive by default but with inline-block display
+ .img-responsive(inline-block);
+}
// Others
::-moz-selection {
diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js
index bb8f5d9cfb7..6791a21f721 100644
--- a/addons/web_editor/static/src/js/widgets/widgets.js
+++ b/addons/web_editor/static/src/js/widgets/widgets.js
@@ -286,7 +286,7 @@ var ImageWidget = MediaWidget.extend({
var img = this.images[0];
if (!img.isDocument) {
if (!this.$media.is('img')) {
- this._replaceMedia($('<img/>', {class: 'img img-responsive'}));
+ this._replaceMedia($('<img/>'));
}
this.$media.attr('src', img.src);
} else {
@@ -409,7 +409,7 @@ var ImageWidget = MediaWidget.extend({
var $div = $(el);
if (/gif|jpe|jpg|png/.test($div.data('mimetype'))) {
var $img = $('<img/>', {
- class: 'img img-responsive',
+ class: 'img-responsive',
src: $div.data('url') || $div.data('src'),
});
var def = $.Deferred();