From 24ec9ec6166f159d22b890512058c5ca918462fb Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 18 Jul 2011 10:10:46 +0200 Subject: [PATCH] [ADD] cancel button to config overview widget bzr revid: xmo@openerp.com-20110718081046-qzwqmik7q5it5mff --- .../static/src/css/dashboard.css | 7 +++++ .../base_dashboard/static/src/js/dashboard.js | 28 +++++++++++++------ .../static/src/xml/base_dashboard.xml | 5 +++- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/addons/base_dashboard/static/src/css/dashboard.css b/addons/base_dashboard/static/src/css/dashboard.css index a5990b6f1bb..47c071b2a65 100644 --- a/addons/base_dashboard/static/src/css/dashboard.css +++ b/addons/base_dashboard/static/src/css/dashboard.css @@ -161,6 +161,8 @@ } .openerp .oe-dashboard-config-overview li { cursor: pointer; + position: relative; + text-indent: 20px; } .openerp .oe-dashboard-config-overview li:hover { cursor: pointer; @@ -177,6 +179,11 @@ -webkit-column-count: 2; column-count: 2; } +.openerp .oe-dashboard-config-overview li span.ui-icon { + position: absolute; + top: 0; + left: 0; +} .openerp .oe-dashboard-home-tile { text-align: center; diff --git a/addons/base_dashboard/static/src/js/dashboard.js b/addons/base_dashboard/static/src/js/dashboard.js index 793a732e007..8332874eafa 100644 --- a/addons/base_dashboard/static/src/js/dashboard.js +++ b/addons/base_dashboard/static/src/js/dashboard.js @@ -299,6 +299,7 @@ openerp.base_dashboard.ConfigOverview = openerp.base.View.extend({ var grouped_todos = _(records).chain() .map(function (record) { return { + id: record.id, action: record.action_id[0], name: record.action_id[1], done: record.state !== 'open', @@ -317,17 +318,26 @@ openerp.base_dashboard.ConfigOverview = openerp.base.View.extend({ var self = this; this.$element.find('div.oe-dashboard-config-overview ul') - .delegate('li', 'click', function () { - self.execute_action({ - type: 'action', - name: $(this).data('action') - }, self.dataset, - self.session.action_manager, - null, null, function () { - // after action popup closed, refresh configuration thingie + .delegate('span.ui-icon', 'click', function (e) { + // cancel todo + e.stopImmediatePropagation(); + var todo_id = $(this).parent().data('id'); + self.dataset.write(todo_id, {state: 'cancel'}, function () { self.start(); }); - }); + }) + .delegate('li', 'click', function () { + self.execute_action({ + type: 'action', + name: $(this).data('action') + }, self.dataset, + self.session.action_manager, + null, null, function () { + // after action popup closed, refresh configuration + // thingie + self.start(); + }); + }); } }); diff --git a/addons/base_dashboard/static/src/xml/base_dashboard.xml b/addons/base_dashboard/static/src/xml/base_dashboard.xml index 9370e1caa07..2eb2a3f7b31 100644 --- a/addons/base_dashboard/static/src/xml/base_dashboard.xml +++ b/addons/base_dashboard/static/src/xml/base_dashboard.xml @@ -77,8 +77,11 @@