Skip to content

Commit 8447731

Browse files
committed
[IMP] awesome_owl: add some facy UI for completed todos
Use dynamic attributes to have a fancy UI for completed todos.
1 parent a99acf9 commit 8447731

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

awesome_owl/static/src/todolist/todoitem.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import { Component, useState, xml } from "@odoo/owl";
33

44
export class TodoItem extends Component {
5-
static template = xml`<div><t t-esc="todo.value.id"/><br/><t t-esc="todo.value.description"/></div>`;
5+
static template = xml`<div t-att-class="{'text-muted': this.todo.value.isCompleted, 'text-decoration-line-through': this.todo.value.isCompleted}">
6+
<t t-esc="todo.value.id"/>. <t t-esc="todo.value.description"/></div>`;
67
static props = {
78
todo : {
89
id: { type: Number },

awesome_owl/static/src/todolist/todolist.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ export class TodoList extends Component {
77
static components = { TodoItem };
88

99
setup() {
10-
this.todos = useState([{ id: 3, description: "buy milk", isCompleted: false }]);
10+
this.todos = useState([
11+
{ id: 3, description: "buy milk", isCompleted: false },
12+
{ id: 4, description: "Go to work", isCompleted: true },
13+
14+
]);
1115
}
1216

1317
}

0 commit comments

Comments
 (0)