move root widget to root folder

This commit is contained in:
Géry Debongnie
2019-01-29 10:00:33 +01:00
parent 2ea569f7aa
commit b024ce3183
2 changed files with 5 additions and 5 deletions
-37
View File
@@ -1,37 +0,0 @@
import { Widget } from "../core/widget";
import { Navbar } from "./navbar";
import { ActionWidget } from "../services/action_manager";
import { Env } from "../env";
const template = `
<div class="o_web_client">
<t t-widget="Navbar"/>
<div class="o_content" t-ref="content">
</div>
</div>
`;
export class RootWidget extends Widget<Env, {}> {
name = "root";
template = template;
widgets = { Navbar };
content: Widget<Env, {}> | null = null;
mounted() {
this.env.actionManager.on("action_ready", this, this.setContentWidget);
const actionWidget = this.env.actionManager.getCurrentAction();
if (actionWidget) {
this.setContentWidget(actionWidget);
}
}
async setContentWidget(actionWidget: ActionWidget) {
const currentWidget = this.content;
const newWidget = new actionWidget.Widget(this, actionWidget.props);
await newWidget.mount(<HTMLElement>this.refs.content);
if (currentWidget) {
currentWidget.destroy();
}
this.content = newWidget;
}
}