From fea50595d644ed864577bef4a30a8fd8d712301d Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 16 Mar 2011 14:31:10 +0100 Subject: [PATCH] [ADD] QWeb: changed behaviour of t-att bzr revid: fme@openerp.com-20110316133110-s0wwdb4yrysxb6q7 --- addons/base/static/qweb/qweb.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/addons/base/static/qweb/qweb.js b/addons/base/static/qweb/qweb.js index 7ce95c5c13f..3bed1f10267 100644 --- a/addons/base/static/qweb/qweb.js +++ b/addons/base/static/qweb/qweb.js @@ -51,6 +51,7 @@ var QWeb = { // TODO: Currently this will also replace and, or, ... in strings. Try // 'hi boys and girls' != '' and 1 == 1 -- will be replaced to : 'hi boys && girls' != '' && 1 == 1 // try to find a solution without tokenizing + e = '(' + e + ')'; e = e.replace(/\band\b/g, " && "); e = e.replace(/\bor\b/g, " || "); e = e.replace(/\bgt\b/g, " > "); @@ -169,10 +170,22 @@ var QWeb = { }, render_att_att:function(e, t_att, g_att, v, ext, av) { if (ext) { - g_att[ext.substring(1)] = this.eval_str(av, v); + var attv = this.eval_object(av, v); + if (attv != null) { + g_att[ext.substring(1)] = attv.toString(); + } } else { var o = this.eval_object(av, v); - g_att[o[0]] = o[1]; + if (o != null) { + // TODO: http://bonsaiden.github.com/JavaScript-Garden/#types.typeof + if (o.constructor == Array && o.length > 1 && o[1] != null) { + g_att[o[0]] = new String(o[1]); + } else if (o.constructor == Object) { + for (var i in o) { + g_att[i] = new String(o[i]); + } + } + } } }, render_att_attf:function(e, t_att, g_att, v, ext, av) {