rename templates, rename Action to ActionContainer

This commit is contained in:
Géry Debongnie
2019-02-03 14:07:25 +01:00
parent 14ef31483f
commit e1bdce57ee
10 changed files with 30 additions and 35 deletions
+1 -1
View File
@@ -2,5 +2,5 @@ import { Widget } from "../core/widget";
import { Env } from "../env";
export class CRM extends Widget<Env, {}> {
template = "crm";
template = "web.crm";
}
+6 -1
View File
@@ -6,7 +6,12 @@ interface Props {
}
export class Counter extends Widget<Env, Props> {
template = "counter";
inlineTemplate = `
<div t-name="counter">
<button t-on-click="increment(-1)">-</button>
<span style="font-weight:bold">Value: <t t-esc="state.counter"/></span>
<button t-on-click="increment(1)">+</button>
</div>`;
state = {
counter: 0
};
+6 -2
View File
@@ -4,7 +4,7 @@ import { Clock } from "./clock";
import { Counter } from "./counter";
export class Discuss extends Widget<Env, {}> {
template = "discuss";
template = "web.discuss";
widgets = { Clock, Counter, ColorWidget };
state = { validcounter: true, color: "red" };
@@ -39,5 +39,9 @@ export class Discuss extends Widget<Env, {}> {
}
class ColorWidget extends Widget<Env, { color: "red" | "blue" }> {
template = "colorwidget";
inlineTemplate = `
<div t-name="colorwidget">
<span>Current Color: </span>
<t t-esc="props.color"/>
</div>`;
}
+1 -1
View File
@@ -6,7 +6,7 @@ export interface Props {
}
export class Navbar extends Widget<Env, Props> {
template = "navbar";
template = "web.navbar";
getUrl(menu: Menu) {
const action_id = String(menu.actionID);
@@ -6,8 +6,8 @@ export interface Props {
stack: ActionStack;
}
export class Action extends Widget<Env, Props> {
template = "action";
export class ActionContainer extends Widget<Env, Props> {
template = "web.action_container";
currentWidget: any;
shouldUpdate(nextProps: Props) {
+1 -1
View File
@@ -2,7 +2,7 @@ import { Widget } from "../core/widget";
import { Env } from "../env";
export class Clock extends Widget<Env, {}> {
template = "clock";
inlineTemplate = `<div class="o_clock"><t t-esc="state.currentTime"/></div>`;
timeout: any | undefined;
state = {
+1 -1
View File
@@ -2,5 +2,5 @@ import { Widget } from "../core/widget";
import { Env } from "../env";
export class HomeMenu extends Widget<Env, {}> {
template = "home";
template = "web.home_menu";
}
+1 -1
View File
@@ -3,7 +3,7 @@ import { Env } from "../env";
import { INotification } from "../core/notifications";
export class Notification extends Widget<Env, INotification> {
template = "notification";
template = "web.notification";
close() {
this.env.notifications.close(this.props.id);
+3 -3
View File
@@ -2,7 +2,7 @@ import { Widget } from "../core/widget";
import { Env } from "../env";
import { ActionStack } from "../services/action_manager";
import { INotification } from "../core/notifications";
import { Action } from "./action";
import { ActionContainer } from "./action_container";
import { HomeMenu } from "./home_menu";
import { Navbar } from "./navbar";
import { Notification } from "./notification";
@@ -22,8 +22,8 @@ interface State {
//------------------------------------------------------------------------------
export class Root extends Widget<Env, {}> {
template = "web_client";
widgets = { Navbar, Notification, HomeMenu, Action };
template = "web.web_client";
widgets = { Navbar, Notification, HomeMenu, ActionContainer };
state: State = {
notifications: [],