File tree Expand file tree Collapse file tree 4 files changed +51
-2
lines changed
awesome_dashboard/static/src Expand file tree Collapse file tree 4 files changed +51
-2
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,13 @@ import { Component } from "@odoo/owl";
4
4
import { registry } from "@web/core/registry" ;
5
5
import { Layout } from "@web/search/layout" ;
6
6
import { useService } from "@web/core/utils/hooks" ;
7
+ import { DashboardItem } from "./dashboard_item/dashboard_item" ;
7
8
8
9
class AwesomeDashboard extends Component {
9
10
static template = "awesome_dashboard.AwesomeDashboard" ;
10
11
11
12
setup ( ) {
12
13
this . action = useService ( "action" ) ;
13
- //this.openSettings = this.openSettings.bind(this);
14
14
}
15
15
openCustomerList ( ) {
16
16
console . log ( 'clicked' ) ;
@@ -21,7 +21,7 @@ class AwesomeDashboard extends Component {
21
21
this . action . doAction ( "crm.crm_lead_all_leads" ) ;
22
22
}
23
23
24
- static components = { Layout } ;
24
+ static components = { Layout, DashboardItem } ;
25
25
}
26
26
27
27
registry . category ( "actions" ) . add ( "awesome_dashboard.dashboard" , AwesomeDashboard ) ;
Original file line number Diff line number Diff line change 13
13
Leads
14
14
</button >
15
15
</t >
16
+ <DashboardItem >
17
+ Hello
18
+ </DashboardItem >
19
+ <DashboardItem size =" 2" >
20
+ Hello
21
+ </DashboardItem >
22
+ <DashboardItem >
23
+ Hello
24
+ </DashboardItem >
16
25
</Layout >
17
26
</t >
18
27
Original file line number Diff line number Diff line change
1
+ /** @odoo -module **/
2
+
3
+ import { Component } from "@odoo/owl" ;
4
+
5
+ export class DashboardItem extends Component {
6
+ static template = "awesome_dashboard.DashboardItem" ;
7
+
8
+ setup ( ) {
9
+ this . width = this . props . size * 18
10
+ }
11
+
12
+ static defaultProps = {
13
+ size : 1 ,
14
+ } ;
15
+
16
+ static props = {
17
+ size : {
18
+ type : Number ,
19
+ optional : true ,
20
+ } ,
21
+ slots : {
22
+ default : Component
23
+ }
24
+ } ;
25
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <templates xml : space =" preserve" >
3
+
4
+ <t t-name =" awesome_dashboard.DashboardItem" >
5
+ <div class =" card d-inline-block m-2" t-attf-style =" width: {{width}}rem;" >
6
+ <div class =" card-body" >
7
+ <h5 class =" card-title" >
8
+ <t t-esc =" props.title" />
9
+ </h5 >
10
+ <t t-slot =" default" />
11
+ </div >
12
+ </div >
13
+ </t >
14
+
15
+ </templates >
You can’t perform that action at this time.
0 commit comments