summaryrefslogtreecommitdiff
path: root/addons/base_dashboard/static/src
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
parentf94300bdf49e5ee5675828fd116cbb8b1ec4cd50 (diff)
[ADD] homescreen application tiles
bzr revid: xmo@openerp.com-20110705114258-upkmqyzzqhebs34l
Diffstat (limited to 'addons/base_dashboard/static/src')
-rw-r--r--addons/base_dashboard/static/src/css/dashboard.css45
-rw-r--r--addons/base_dashboard/static/src/js/dashboard.js31
-rw-r--r--addons/base_dashboard/static/src/xml/base_dashboard.xml18
3 files changed, 94 insertions, 0 deletions
diff --git a/addons/base_dashboard/static/src/css/dashboard.css b/addons/base_dashboard/static/src/css/dashboard.css
index 2c9cc513ef0..f513995b549 100644
--- a/addons/base_dashboard/static/src/css/dashboard.css
+++ b/addons/base_dashboard/static/src/css/dashboard.css
@@ -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;
+}
+
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();});
+ });
+ }
})
};
diff --git a/addons/base_dashboard/static/src/xml/base_dashboard.xml b/addons/base_dashboard/static/src/xml/base_dashboard.xml
index 43572a5bda4..91fa13d763a 100644
--- a/addons/base_dashboard/static/src/xml/base_dashboard.xml
+++ b/addons/base_dashboard/static/src/xml/base_dashboard.xml
@@ -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>