mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
rename templates, rename Action to ActionContainer
This commit is contained in:
@@ -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,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
|
||||
};
|
||||
|
||||
@@ -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>`;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
Reference in New Issue
Block a user