Skip to content

Commit 143eec9

Browse files
committed
[IMP] awesome_owl: add section 13
1 parent 86806ec commit 143eec9

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

awesome_owl/static/src/card/card.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ import { Component, useState } from "@odoo/owl";
22

33
export class Card extends Component {
44
static template = "awesome_owl.card";
5-
static props = { title: {type: String}, content: {type: String}}
5+
static props = {
6+
title: String,
7+
slots: {
8+
type: Object,
9+
shape: {
10+
default: true
11+
},
12+
}
13+
}
614

715
setup() {
8-
this.title = this.props.title;
9-
this.content = this.props.content;
16+
this.title = this.props.title;
1017
}
1118
}

awesome_owl/static/src/card/card.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="card-body">
77
<h5 class="card-title"><t t-esc="this.title"/></h5>
88
<p class="card-text">
9-
<t t-out="this.content"/>
9+
<t t-slot="default"/>
1010
</p>
1111
</div>
1212
</div>

awesome_owl/static/src/playground.xml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@
99
<Counter value="this.state.val2" side_effect.bind="() => this.state.val2++"/>
1010
<div>The sum is: <t t-esc="sum"/></div>
1111
<Counter/>
12-
<Card title="'card title'" content="'card content'"/>
13-
<Card title="'card title'" content="str1"/>
14-
<Card title="'card title'" content="str2"/>
12+
<Card title="'epic card title'">
13+
New content for the new card
14+
</Card>
15+
<Card title="'cute card title'">
16+
this should work with arbitrary html content
17+
</Card>
18+
<Card title="'scary card title'">
19+
Here is a cool counter for you
20+
<Counter/>
21+
</Card>
1522

1623
<TodoList/>
1724
</t>

awesome_owl/static/src/todo_list/todo_list.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export class TodoList extends Component {
99
setup() {
1010
useAutoFocus("todo-input");
1111
this.state = useState({todos: {
12-
2: { description: "penser à acheter du lait", isCompleted: false },
13-
3: { description: "penser à acheter des tomates cerises", isCompleted: true }
12+
2: { description: "buy milk", isCompleted: false },
13+
3: { description: "buy tomatoes", isCompleted: true }
1414
},
1515
lastId: 3
1616
});

0 commit comments

Comments
 (0)