summaryrefslogtreecommitdiff
path: root/addons/base_dashboard/static/src/js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2011-07-05 13:42:58 +0200
committerXavier Morel <xmo@openerp.com>2011-07-05 13:42:58 +0200
commit433f2fb5fce473550d35871f12b0e60460d6486c (patch)
tree3d099c0df0b749bfed8db6163f7bc007a515c8ca /addons/base_dashboard/static/src/js
parentf94300bdf49e5ee5675828fd116cbb8b1ec4cd50 (diff)
[ADD] homescreen application tiles
bzr revid: xmo@openerp.com-20110705114258-upkmqyzzqhebs34l
Diffstat (limited to 'addons/base_dashboard/static/src/js')
-rw-r--r--addons/base_dashboard/static/src/js/dashboard.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/addons/base_dashboard/static/src/js/dashboard.js b/addons/base_dashboard/static/src/js/dashboard.js
index df2ae08e5de..b1e925c7b0a 100644
--- a/addons/base_dashboard/static/src/js/dashboard.js
+++ b/addons/base_dashboard/static/src/js/dashboard.js
@@ -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();});
+ });
+ }
})
};