[IMP] qweb: add global Component registry to qweb

Closes #112
This commit is contained in:
Aaron Bohy
2019-05-23 16:14:52 +02:00
committed by Géry Debongnie
parent 24c569e6d5
commit 7cdd1aa9a1
6 changed files with 73 additions and 9 deletions
+4 -1
View File
@@ -343,6 +343,7 @@ QWeb.addDirective({
atNodeEncounter({ ctx, value, node }): boolean {
ctx.addLine("//WIDGET");
ctx.rootContext.shouldDefineOwner = true;
ctx.rootContext.shouldDefineQWeb = true;
ctx.rootContext.shouldDefineUtils = true;
let props = node.getAttribute("t-props");
let keepAlive = node.getAttribute("t-keepalive") ? true : false;
@@ -458,7 +459,9 @@ QWeb.addDirective({
ctx.addIf(`!w${widgetID}`);
// new widget
ctx.addLine(`let W${widgetID} = context.widgets['${value}'];`);
ctx.addLine(
`let W${widgetID} = context.widgets && context.widgets['${value}'] || QWeb.widgets['${value}'];`
);
// maybe only do this in dev mode...
ctx.addLine(