Skip to content

Commit 3187e2e

Browse files
committed
[IMP] awesome_dashboard: add a dashboard item
1 parent 8ae5640 commit 3187e2e

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

awesome_dashboard/static/src/dashboard.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import { Component } from "@odoo/owl";
55
import { registry } from "@web/core/registry";
66
import { Layout } from "@web/search/layout";
77
import { useService } from "@web/core/utils/hooks";
8+
import { DashboardItem } from "./dashboard_item";
89

910
class AwesomeDashboard extends Component {
1011
static template = "awesome_dashboard.AwesomeDashboard";
11-
static components = { Layout };
12+
static components = { Layout, DashboardItem };
1213

1314
setup() {
1415
this.action = useService("action");

awesome_dashboard/static/src/dashboard.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
<button class="btn btn-primary" t-on-click="openCustomers">Customers</button>
88
<button class="btn btn-primary" t-on-click="openLeads">Leads</button>
99
</t>
10+
<div class="d-inline-flex p-4">
11+
<DashboardItem>some content</DashboardItem>
12+
<DashboardItem size="2">I love milk</DashboardItem>
13+
<DashboardItem>some content</DashboardItem>
14+
</div>
1015
</Layout>
1116
</t>
1217

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Component } from "@odoo/owl";
2+
3+
export class DashboardItem extends Component {
4+
static template = "awesome_dashboard.DashboardItem"
5+
6+
static props = {'size': {type: Number, optional: true }}
7+
8+
setup() {
9+
if(!this.props.size) {
10+
this.props.size = 1
11+
}
12+
}
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<templates xml:space="preserve">
3+
<t t-name="awesome_dashboard.DashboardItem">
4+
<div class="card m-2" t-attf-style="width:{{18 * props.size}}rem;">
5+
<div class="card-body">
6+
</div>
7+
<t t-slot="default">
8+
</t>
9+
</div>
10+
</t>
11+
</templates>

0 commit comments

Comments
 (0)