[ADD] cancel button to config overview widget

bzr revid: xmo@openerp.com-20110718081046-qzwqmik7q5it5mff
This commit is contained in:
Xavier Morel
2011-07-18 10:10:46 +02:00
parent 6e743f64b0
commit 24ec9ec616
3 changed files with 30 additions and 10 deletions
@@ -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;
@@ -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();
});
});
}
});
@@ -77,8 +77,11 @@
<dd><ul>
<li t-foreach="category_value" t-as="todo"
t-att-class="todo.done ? 'oe-done' : undefined"
t-att-data-action="todo.action">
t-att-data-action="todo.action" t-att-data-id="todo.id"
t-att-title="'Execute action \'' + todo.name + '\''">
<t t-esc="todo.name"/>
<span class="ui-icon ui-icon-closethick"
title="Cancel task, remove it from list"/>
</li>
</ul></dd>
</t>