[IMP] qweb: make t-key directive dynamic

instead of having t-key and t-att-key.

closes #36
This commit is contained in:
Géry Debongnie
2019-04-16 14:35:27 +02:00
parent 7092f5e142
commit 0ca4cc1596
5 changed files with 84 additions and 10 deletions
+8 -7
View File
@@ -632,7 +632,13 @@ export class QWeb {
}
}
let nodeID = ctx.generateID();
const parts = [`key:${nodeID}`];
let nodeKey: any = (<Element>node).getAttribute("t-key");
if (nodeKey) {
nodeKey = ctx.formatExpression(nodeKey);
} else {
nodeKey = nodeID;
}
const parts = [`key:${nodeKey}`];
if (attrs.length + tattrs.length > 0) {
parts.push(`attrs:{${attrs.join(",")}}`);
}
@@ -995,12 +1001,7 @@ const widgetDirective: Directive = {
let key = node.getAttribute("t-key");
if (key) {
key = `"${key}"`;
} else {
key = node.getAttribute("t-att-key");
if (key) {
key = ctx.formatExpression(key);
}
key = ctx.formatExpression(key);
}
if (props) {
props = ctx.formatExpression(props);