Skip to content

Commit

Permalink
[ADD] QWeb: changed behaviour of t-att
Browse files Browse the repository at this point in the history
bzr revid: fme@openerp.com-20110316133110-s0wwdb4yrysxb6q7
  • Loading branch information
amigrave committed Mar 16, 2011
1 parent dfb1e2b commit fea5059
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions addons/base/static/qweb/qweb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, " > ");
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fea5059

Please sign in to comment.