summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-08-08 11:15:32 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-08-08 11:15:32 +0200
commit5d416152174d740aaa4b4e86a98f4dbd421ac541 (patch)
tree0c6728886ee7f5abdf8924cdcd67f749087d3c44
parent71cd55490ab73e16811c960f0f45bc9f4aa4aaf0 (diff)
[FIX] fixed problems with images in kanban o2m
bzr revid: nicolas.vanhoren@openerp.com-20120808091532-zjnvgpx33nkwj1z8
-rw-r--r--addons/web/static/src/js/view_form.js2
-rw-r--r--addons/web_kanban/static/src/js/kanban.js15
2 files changed, 10 insertions, 7 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index c3f941305d5..8276a1b219c 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -4606,7 +4606,7 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
},
render_value: function() {
var url;
- if (this.get('value') && this.get('value').substr(0, 10).indexOf(' ') == -1) {
+ if (this.get('value') && ! /^\d+(\.\d*)? \w+$/.test(this.get('value'))) {
url = 'data:image/png;base64,' + this.get('value');
} else if (this.get('value')) {
url = '/web/binary/image?session_id=' + this.session.session_id + '&model=' +
diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js
index 4856c5d174a..8761b88690f 100644
--- a/addons/web_kanban/static/src/js/kanban.js
+++ b/addons/web_kanban/static/src/js/kanban.js
@@ -750,14 +750,17 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({
return 'http://www.gravatar.com/avatar/' + email_md5 + '.png?s=' + size + '&d=' + default_;
},
kanban_image: function(model, field, id, cache) {
- id = id || '';
- var url = instance.connection.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + id;
- if (cache !== undefined) {
- // Set the cache duration in seconds.
- url += '&cache=' + parseInt(cache, 10);
- }
+ var url;
if (this.record[field] && this.record[field].value && ! /^\d+(\.\d*)? \w+$/.test(this.record[field].value)) {
url = 'data:image/png;base64,' + this.record[field].value;
+ } else if (this.record[field] && ! this.record[field].value) {
+ url = "/web/static/src/img/placeholder.png";
+ } else {
+ url = instance.connection.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + id;
+ if (cache !== undefined) {
+ // Set the cache duration in seconds.
+ url += '&cache=' + parseInt(cache, 10);
+ }
}
return url;
},