Skip to content

Commit 61dd212

Browse files
committed
[ADD] awsome_owl: task 1 + 2
1 parent 03cee0d commit 61dd212

File tree

5 files changed

+37
-3
lines changed

5 files changed

+37
-3
lines changed

awesome_owl/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
'assets': {
3030
'awesome_owl.assets_playground': [
3131
('include', 'web._assets_helpers'),
32+
('include', 'web._assets_backend_helpers'),
3233
'web/static/src/scss/pre_variables.scss',
3334
'web/static/lib/bootstrap/scss/_variables.scss',
3435
('include', 'web._assets_bootstrap'),
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { useState, Component } from "@odoo/owl";
2+
3+
export class Counter extends Component {
4+
static template = "awesome_owl.Counter";
5+
6+
setup() {
7+
this.state = useState({ value: 0 });
8+
}
9+
10+
increment() {
11+
this.state.value++;
12+
}
13+
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<templates xml:space="preserve">
3+
4+
<t t-name="awesome_owl.Counter">
5+
<p>Counter: <t t-esc="state.value"/></p>
6+
<button class="btn btn-primary" t-on-click="increment">Increment</button>
7+
</t>
8+
9+
</templates>
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
import { Component } from "@odoo/owl";
1+
import { Component, useState } from "@odoo/owl";
2+
import { Counter } from "./counter/counter"
23

34
export class Playground extends Component {
4-
static template = "awesome_owl.playground";
5+
static template = "awesome_owl.Playground";
6+
static components = {Counter};
7+
8+
setup() {
9+
}
10+
511
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<templates xml:space="preserve">
33

4-
<t t-name="awesome_owl.playground">
4+
<t t-name="awesome_owl.Playground">
55
<div class="p-3">
66
hello world
77
</div>
8+
<div>
9+
<Counter/>
10+
<Counter/>
11+
</div>
812
</t>
913

1014
</templates>

0 commit comments

Comments
 (0)