[ADD] Kanban: added possibility to use tooltips

bzr revid: fme@openerp.com-20111128150003-t6bu6c63xnoy1lhg
This commit is contained in:
Fabien Meghazi 2011-11-28 16:00:03 +01:00
parent 4d7fff7851
commit 8b2f958cb0
2 changed files with 25 additions and 3 deletions

View File

@ -114,6 +114,9 @@
.openerp .oe_kanban_table tr td {
padding: 0;
}
.openerp .oe_kanban_table tr td.oe_kanban_title3 {
padding: 2px;
}
.openerp .oe_kanban_gravatar {
display: block;
}
@ -194,6 +197,12 @@
.openerp .oe_kanban_color_border {
border-color: #CCCCCC;
}
.openerp .oe_kanban_tooltip ul,
.openerp ul.oe_kanban_tooltip {
padding: 0 0 4px 0;
margin: 5px 0 0 15px;
list-style: circle;
}
/* Custom colors are also present in kanban.js */
/* Custom color#0 */

View File

@ -387,17 +387,17 @@ openerp.web_kanban.KanbanRecord = openerp.web.Widget.extend({
return new_record;
},
render: function() {
var ctx = {
this.qweb_context = {
record: this.record,
widget: this
}
for (var p in this) {
if (_.str.startsWith(p, 'kanban_')) {
ctx[p] = _.bind(this[p], this);
this.qweb_context[p] = _.bind(this[p], this);
}
}
return this._super({
'content': this.view.qweb.render('kanban-box', ctx)
'content': this.view.qweb.render('kanban-box', this.qweb_context)
});
},
bind_events: function() {
@ -408,6 +408,19 @@ openerp.web_kanban.KanbanRecord = openerp.web.Widget.extend({
$show_on_click.toggle();
self.state.folded = !self.state.folded;
});
this.$element.find('[tooltip]').tipTip({
maxWidth: 500,
defaultPosition: 'top',
content: function() {
var template = $(this).attr('tooltip');
if (!self.view.qweb.has_template(template)) {
return false;
}
return self.view.qweb.render(template, self.qweb_context);
}
});
this.$element.find('.oe_kanban_action').click(function() {
var $action = $(this),
type = $action.data('type') || 'button',