[ADD] homescreen application tiles
bzr revid: xmo@openerp.com-20110705114258-upkmqyzzqhebs34l
This commit is contained in:
@@ -148,3 +148,48 @@
|
||||
display: inline-block;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.openerp .oe-dashboard-home-tile {
|
||||
text-align: center;
|
||||
margin: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
-moz-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
-webkit-box-shadow: 3px 3px 5px 3px #DADDDD;
|
||||
-moz-box-shadow: 3px 3px 5px 3px #DADDDD;
|
||||
box-shadow: 3px 3px 5px 3px #DADDDD;
|
||||
}
|
||||
.openerp .oe-dashboard-home-tile span {
|
||||
display: block;
|
||||
padding: 0 0 15px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
color: #555;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.openerp .oe-dashboard-home-tile-icon {
|
||||
height: 100px;
|
||||
}
|
||||
.openerp .oe-dashboard-home-tile-icon img {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.openerp .oe-dashboard-home-tile-icon img.hover {
|
||||
display: none;
|
||||
}
|
||||
.openerp .oe-dashboard-home-tile:hover {
|
||||
background-color: #fafafa;
|
||||
-webkit-box-shadow: 3px 3px 5px 3px #979797;
|
||||
-moz-box-shadow: 3px 3px 5px 3px #979797;
|
||||
box-shadow: 3px 3px 5px 3px #979797;
|
||||
}
|
||||
.openerp .oe-dashboard-home-tile:hover img {
|
||||
display: none;
|
||||
}
|
||||
.openerp .oe-dashboard-home-tile:hover img.hover {
|
||||
display: block;
|
||||
}
|
||||
.openerp .oe-dashboard-home-tile:hover span {
|
||||
color: black;
|
||||
}
|
||||
|
||||
|
||||
@@ -324,5 +324,36 @@ openerp.base_dashboard.ConfigOverview = openerp.base.View.extend({
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
openerp.base.client_actions.add(
|
||||
'board.home.applications', 'openerp.base_dashboard.ApplicationTiles');
|
||||
openerp.base_dashboard.ApplicationTiles = openerp.base.View.extend({
|
||||
init: function (parent_or_session, element_id) {
|
||||
this._super(parent_or_session, element_id);
|
||||
this.dataset = new openerp.base.DataSetSearch(
|
||||
this.session, 'ir.ui.menu', null, [['parent_id', '=', false]]);
|
||||
},
|
||||
start: function () {
|
||||
var self = this;
|
||||
this.dataset.read_slice(
|
||||
['name', 'web_icon_data', 'web_icon_hover_data'],
|
||||
null, null, function (applications) {
|
||||
// Create a matrix of 3*x applications
|
||||
var rows = [];
|
||||
while (applications.length) {
|
||||
rows.push(applications.splice(0, 3));
|
||||
}
|
||||
self.$element
|
||||
.append(QWeb.render(
|
||||
'ApplicationTiles', {rows: rows}))
|
||||
.find('.oe-dashboard-home-tile')
|
||||
.click(function () {
|
||||
var $this = $(this);
|
||||
$this.closest('.openerp')
|
||||
.find('.menu a[data-menu=' + $this.data('menuid') + ']')
|
||||
.click();});
|
||||
});
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
@@ -80,4 +80,22 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div t-name="ApplicationTiles" class="oe-dashboard-home-tiles">
|
||||
<table width="100%">
|
||||
<tr t-foreach="rows" t-as="row">
|
||||
<td t-foreach="row" t-as="application" width="33.3%">
|
||||
<div class="oe-dashboard-home-tile"
|
||||
t-att-data-menuid="application.id">
|
||||
<div class="oe-dashboard-home-tile-icon">
|
||||
<img t-if="application.web_icon_data"
|
||||
t-att-src="'data:image/png;base64,' + application.web_icon_data"
|
||||
/><img t-if="application.web_icon_hover_data" class="hover"
|
||||
t-att-src="'data:image/png;base64,' + application.web_icon_hover_data"/>
|
||||
</div>
|
||||
<span><t t-esc="application.name"/></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user