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";
|
import { Env } from "../env";
|
||||||
|
|
||||||
export class CRM extends Widget<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> {
|
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 = {
|
state = {
|
||||||
counter: 0
|
counter: 0
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Clock } from "./clock";
|
|||||||
import { Counter } from "./counter";
|
import { Counter } from "./counter";
|
||||||
|
|
||||||
export class Discuss extends Widget<Env, {}> {
|
export class Discuss extends Widget<Env, {}> {
|
||||||
template = "discuss";
|
template = "web.discuss";
|
||||||
widgets = { Clock, Counter, ColorWidget };
|
widgets = { Clock, Counter, ColorWidget };
|
||||||
state = { validcounter: true, color: "red" };
|
state = { validcounter: true, color: "red" };
|
||||||
|
|
||||||
@@ -39,5 +39,9 @@ export class Discuss extends Widget<Env, {}> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ColorWidget extends Widget<Env, { color: "red" | "blue" }> {
|
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> {
|
export class Navbar extends Widget<Env, Props> {
|
||||||
template = "navbar";
|
template = "web.navbar";
|
||||||
|
|
||||||
getUrl(menu: Menu) {
|
getUrl(menu: Menu) {
|
||||||
const action_id = String(menu.actionID);
|
const action_id = String(menu.actionID);
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ export interface Props {
|
|||||||
stack: ActionStack;
|
stack: ActionStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Action extends Widget<Env, Props> {
|
export class ActionContainer extends Widget<Env, Props> {
|
||||||
template = "action";
|
template = "web.action_container";
|
||||||
currentWidget: any;
|
currentWidget: any;
|
||||||
|
|
||||||
shouldUpdate(nextProps: Props) {
|
shouldUpdate(nextProps: Props) {
|
||||||
@@ -2,7 +2,7 @@ import { Widget } from "../core/widget";
|
|||||||
import { Env } from "../env";
|
import { Env } from "../env";
|
||||||
|
|
||||||
export class Clock extends Widget<Env, {}> {
|
export class Clock extends Widget<Env, {}> {
|
||||||
template = "clock";
|
inlineTemplate = `<div class="o_clock"><t t-esc="state.currentTime"/></div>`;
|
||||||
timeout: any | undefined;
|
timeout: any | undefined;
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ import { Widget } from "../core/widget";
|
|||||||
import { Env } from "../env";
|
import { Env } from "../env";
|
||||||
|
|
||||||
export class HomeMenu extends Widget<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";
|
import { INotification } from "../core/notifications";
|
||||||
|
|
||||||
export class Notification extends Widget<Env, INotification> {
|
export class Notification extends Widget<Env, INotification> {
|
||||||
template = "notification";
|
template = "web.notification";
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.env.notifications.close(this.props.id);
|
this.env.notifications.close(this.props.id);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Widget } from "../core/widget";
|
|||||||
import { Env } from "../env";
|
import { Env } from "../env";
|
||||||
import { ActionStack } from "../services/action_manager";
|
import { ActionStack } from "../services/action_manager";
|
||||||
import { INotification } from "../core/notifications";
|
import { INotification } from "../core/notifications";
|
||||||
import { Action } from "./action";
|
import { ActionContainer } from "./action_container";
|
||||||
import { HomeMenu } from "./home_menu";
|
import { HomeMenu } from "./home_menu";
|
||||||
import { Navbar } from "./navbar";
|
import { Navbar } from "./navbar";
|
||||||
import { Notification } from "./notification";
|
import { Notification } from "./notification";
|
||||||
@@ -22,8 +22,8 @@ interface State {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
export class Root extends Widget<Env, {}> {
|
export class Root extends Widget<Env, {}> {
|
||||||
template = "web_client";
|
template = "web.web_client";
|
||||||
widgets = { Navbar, Notification, HomeMenu, Action };
|
widgets = { Navbar, Notification, HomeMenu, ActionContainer };
|
||||||
|
|
||||||
state: State = {
|
state: State = {
|
||||||
notifications: [],
|
notifications: [],
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<templates id="template" xml:space="preserve">
|
<templates id="template" xml:space="preserve">
|
||||||
|
|
||||||
<div t-name="web_client" class="o_web_client">
|
<div t-name="web.web_client" class="o_web_client">
|
||||||
<t t-widget="Navbar" t-props="{inHome:state.inHome,app:state.currentApp}" t-on-toggle-home-menu="toggleHome"/>
|
<t t-widget="Navbar" t-props="{inHome:state.inHome,app:state.currentApp}" t-on-toggle-home-menu="toggleHome"/>
|
||||||
<t t-if="state.inHome">
|
<t t-if="state.inHome">
|
||||||
<t t-widget="HomeMenu" t-keep-alive="1" t-props="{apps:apps, openApp: openApp}"/>
|
<t t-widget="HomeMenu" t-keep-alive="1" t-props="{apps:apps, openApp: openApp}"/>
|
||||||
</t>
|
</t>
|
||||||
<t t-else="1">
|
<t t-else="1">
|
||||||
<t t-widget="Action" t-props="{stack:state.stack}" t-keep-alive="1"/>
|
<t t-widget="ActionContainer" t-props="{stack:state.stack}" t-keep-alive="1"/>
|
||||||
</t>
|
</t>
|
||||||
<div class="o_notification_container">
|
<div class="o_notification_container">
|
||||||
<t t-foreach="state.notifications" t-as="notif">
|
<t t-foreach="state.notifications" t-as="notif">
|
||||||
@@ -16,23 +16,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div t-name="action" class="o_content"/>
|
<div t-name="web.action_container" class="o_content"/>
|
||||||
<div t-name="clock" class="o_clock">
|
|
||||||
<t t-esc="state.currentTime"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div t-name="counter">
|
<div t-name="web.crm" class="o_crm">
|
||||||
<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>
|
|
||||||
|
|
||||||
<div t-name="crm" class="o_crm">
|
|
||||||
<span>CRM!!!!</span>
|
<span>CRM!!!!</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div t-name="discuss" class="o_discuss">
|
<div t-name="web.discuss" class="o_discuss">
|
||||||
<span>DISCUSS!!</span>
|
<span>DISCUSS!!</span>
|
||||||
<button t-on-click="resetCounter">Reset first counter</button>
|
<button t-on-click="resetCounter">Reset first counter</button>
|
||||||
<button t-on-click="resetCounterAsync">Reset counter 2 in 3s</button>
|
<button t-on-click="resetCounterAsync">Reset counter 2 in 3s</button>
|
||||||
@@ -52,11 +42,11 @@
|
|||||||
<button t-on-click="addNotif(true)">Add sticky notif</button>
|
<button t-on-click="addNotif(true)">Add sticky notif</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div t-name="home" class="o_home_menu">
|
<div t-name="web.home_menu" class="o_home_menu">
|
||||||
<span>HOME MENU</span>
|
<span>HOME MENU</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div t-name="navbar" class="o_navbar">
|
<div t-name="web.navbar" class="o_navbar">
|
||||||
<a aria-label="Applications" class="o_title fa fa-th" href="#" title="Applications" accesskey="h" t-on-click="toggleHome"/>
|
<a aria-label="Applications" class="o_title fa fa-th" href="#" title="Applications" accesskey="h" t-on-click="toggleHome"/>
|
||||||
<ul t-if="!props.inMenu">
|
<ul t-if="!props.inMenu">
|
||||||
<li t-foreach="env.menus" t-as="menu">
|
<li t-foreach="env.menus" t-as="menu">
|
||||||
@@ -68,7 +58,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div t-name="notification" class="o_notification">
|
<div t-name="web.notification" class="o_notification">
|
||||||
<a t-if="props.sticky" class="fa fa-times o_close" href="#" title="Close" aria-label="Close" t-on-click="close"/>
|
<a t-if="props.sticky" class="fa fa-times o_close" href="#" title="Close" aria-label="Close" t-on-click="close"/>
|
||||||
<div class="o_notification_title">
|
<div class="o_notification_title">
|
||||||
<t t-raw="props.title"/>
|
<t t-raw="props.title"/>
|
||||||
@@ -79,8 +69,4 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div t-name="colorwidget">
|
|
||||||
<span>Current Color: </span>
|
|
||||||
<t t-esc="props.color"/>
|
|
||||||
</div>
|
|
||||||
</templates>
|
</templates>
|
||||||
|
|||||||
Reference in New Issue
Block a user