[FIX] web_kanban_sparkline: Floating format

The format of a float value must consider the language of
the user.

opw:632348
This commit is contained in:
Goffin Simon 2015-04-14 17:38:11 +02:00
parent 3b6eae8b1e
commit a5a797d0a6
1 changed files with 10 additions and 0 deletions

View File

@ -11,6 +11,15 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten
var self = this;
var title = this.$node.html() || this.field.string;
setTimeout(function () {
var tooltipFormatter = function(sp, options, fields) {
var format = $.spformat('<div class="jqsfield">{{offset:offset}} {{formatted_value}}</div>');
var result = '';
$.each(fields, function(i, field) {
field.formatted_value = instance.web.format_value(field.value, { type : 'float' });
result += format.render(field, options.get('tooltipValueLookups'), options);
})
return result;
}
var field_value = JSON.parse(self.field.value);
var value = _.pluck(field_value, 'value');
var tooltips = _.pluck(field_value, 'tooltip');
@ -24,6 +33,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten
barSpacing: 1,
barColor: '#96d854',
tooltipFormat: tooltipFormat,
tooltipFormatter: self.options.type == 'tristate' ? undefined : tooltipFormatter,
chartRangeMin: 0,
tooltipValueLookups: {
'offset': tooltips