[IMP] web: improve kanban tooltip
1) Remove the total record tooltip from kanban group. 2) Remove progressbar help from kanban view. 3) Improvements in testcase since we have removed total record tooltip.
This commit is contained in:
committed by
Yannick Tivisse
parent
f5c269db12
commit
d09ecc8b18
@@ -81,11 +81,11 @@ var KanbanColumn = Widget.extend({
|
||||
}
|
||||
|
||||
if (options.group_by_tooltip) {
|
||||
this.tooltipInfo = _.map(options.group_by_tooltip, function (help, field) {
|
||||
return (data.tooltipData && data.tooltipData[field] && "<div>" + help + "<br>" + data.tooltipData[field] + "</div>") || '';
|
||||
}).join('');
|
||||
} else {
|
||||
this.tooltipInfo = "";
|
||||
this.tooltipInfo = _.compact(_.map(options.group_by_tooltip, function (help, field) {
|
||||
help = help ? help + "</br>" : '';
|
||||
return (data.tooltipData && data.tooltipData[field] && "<div>" + help + data.tooltipData[field] + "</div>") || '';
|
||||
}));
|
||||
this.tooltipInfo = this.tooltipInfo.join("<div class='dropdown-divider' role='separator' />");
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -102,7 +102,6 @@ var KanbanColumn = Widget.extend({
|
||||
defs.push(def);
|
||||
}
|
||||
}
|
||||
this.$header.find('.o_kanban_header_title').tooltip();
|
||||
|
||||
if (!config.device.isMobile) {
|
||||
// deactivate sortable in mobile mode. It does not work anyway,
|
||||
@@ -162,9 +161,9 @@ var KanbanColumn = Widget.extend({
|
||||
this.$header.find('.o_column_title').text(title);
|
||||
|
||||
this.$el.toggleClass('o_column_folded', this.folded && !config.device.isMobile);
|
||||
var tooltip = this.data.count + _t(' records');
|
||||
tooltip = '<p>' + tooltip + '</p>' + this.tooltipInfo;
|
||||
this.$header.find('.o_kanban_header_title').tooltip({}).attr('data-original-title', tooltip);
|
||||
if (this.tooltipInfo) {
|
||||
this.$header.find('.o_kanban_header_title').tooltip({}).attr('data-original-title', this.tooltipInfo);
|
||||
}
|
||||
if (!this.remaining) {
|
||||
this.$('.o_kanban_load_more').remove();
|
||||
} else {
|
||||
|
||||
@@ -30,7 +30,6 @@ var KanbanColumnProgressBar = Widget.extend({
|
||||
this.fieldName = columnState.progressBarValues.field;
|
||||
this.colors = columnState.progressBarValues.colors;
|
||||
this.sumField = columnState.progressBarValues.sum_field;
|
||||
this.progressBarHelp = columnState.progressBarValues.help;
|
||||
|
||||
// Previous progressBar state
|
||||
var state = options.progressBarStates[this.columnID];
|
||||
@@ -131,13 +130,6 @@ var KanbanColumnProgressBar = Widget.extend({
|
||||
}
|
||||
},
|
||||
});
|
||||
if (this.progressBarHelp && _.every(this.subgroupCounts, function (val) { return val === 0; })) {
|
||||
this.$el.tooltip({
|
||||
delay: 0,
|
||||
trigger: 'hover',
|
||||
title: this.progressBarHelp,
|
||||
});
|
||||
}
|
||||
|
||||
// Display and animate the progress bars
|
||||
var barNumber = 0;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div t-attf-class="o_kanban_group#{widget.data_records.length == 0 ? ' o_kanban_no_records' : ''}" t-att-data-id="widget.id or widget.db_id"
|
||||
role="feed" t-attf-aria-labelledby="kanban_header_#{widget.id or widget.db_id}">
|
||||
<div class="o_kanban_header">
|
||||
<div class="o_kanban_header_title" t-att-title="widget.data_records.length + ' records'" data-delay="500">
|
||||
<div class="o_kanban_header_title">
|
||||
<span t-attf-id="#kanban_header_#{widget.id or widget.db_id}" class="o_column_title"><t t-esc="widget.title"/></span>
|
||||
<span class="o_column_unfold"><i class="fa fa-arrows-h" role="img" aria-label="Unfold" title="Unfold"/></span>
|
||||
<span class="o_kanban_config dropdown">
|
||||
|
||||
@@ -4246,15 +4246,13 @@ QUnit.module('Views', {
|
||||
"column should contain 1 record(s)");
|
||||
assert.ok(kanban.$('.o_kanban_group:first span.o_column_title:contains(Undefined)').length,
|
||||
"first column should have a default title for when no value is provided");
|
||||
assert.strictEqual(kanban.$('.o_kanban_group:first .o_kanban_header_title').data('original-title'),
|
||||
"<p>1 records</p>",
|
||||
"first column should have a tooltip with the number of records, but not" +
|
||||
"the group_by_tooltip title and the many2one field value since it has no value");
|
||||
assert.ok(!kanban.$('.o_kanban_group:first .o_kanban_header_title').data('original-title'),
|
||||
"tooltip of first column should not defined, since group_by_tooltip title and the many2one field has no value");
|
||||
assert.ok(kanban.$('.o_kanban_group:eq(1) span.o_column_title:contains(hello)').length,
|
||||
"second column should have a title with a value from the many2one");
|
||||
assert.strictEqual(kanban.$('.o_kanban_group:eq(1) .o_kanban_header_title').data('original-title'),
|
||||
"<p>2 records</p><div>Kikou<br>hello</div>",
|
||||
"second column should have a tooltip with the number of records, the group_by_tooltip title and many2one field value");
|
||||
"<div>Kikou</br>hello</div>",
|
||||
"second column should have a tooltip with the group_by_tooltip title and many2one field value");
|
||||
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user