[MERGE] [FIX] web_kanban_gauge: check the value entered in the forecast
[IMP] web_kanban_sparkline: added an option to add a suffix in the sparkline tooltips bzr revid: tde@openerp.com-20131205160010-8ecv8b618fa6rywj
This commit is contained in:
commit
84375d5a3e
|
@ -440,7 +440,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
||||||
new_group.do_save_sequences();
|
new_group.do_save_sequences();
|
||||||
}).fail(function(error, evt) {
|
}).fail(function(error, evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
alert(_t("An error has occured while moving the record to this group: ") + data.message);
|
alert(_t("An error has occured while moving the record to this group: ") + error.data.message);
|
||||||
self.do_reload(); // TODO: use draggable + sortable in order to cancel the dragging when the rcp fails
|
self.do_reload(); // TODO: use draggable + sortable in order to cancel the dragging when the rcp fails
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ openerp.web_kanban_gauge = function (instance) {
|
||||||
* Kanban widgets: GaugeWidget
|
* Kanban widgets: GaugeWidget
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
var _t = instance.web._t,
|
||||||
|
_lt = instance.web._lt;
|
||||||
|
|
||||||
instance.web_kanban.GaugeWidget = instance.web_kanban.AbstractField.extend({
|
instance.web_kanban.GaugeWidget = instance.web_kanban.AbstractField.extend({
|
||||||
className: "oe_gauge",
|
className: "oe_gauge",
|
||||||
|
@ -77,13 +79,18 @@ instance.web_kanban.GaugeWidget = instance.web_kanban.AbstractField.extend({
|
||||||
$input.focus()
|
$input.focus()
|
||||||
.keydown(function (event) {
|
.keydown(function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (event.keyCode == 13 || event.keyCode == 9) {
|
if(isNaN($input.val())){
|
||||||
if ($input.val() != value) {
|
self.do_warn(_t("Wrong value entered!"), _t("Only Integer Value should be valid."));
|
||||||
parent.view.dataset.call(self.options.action_change, [parent.id, $input.val()]).then(function () {
|
$div.remove();
|
||||||
parent.do_reload();
|
} else {
|
||||||
});
|
if (event.keyCode == 13 || event.keyCode == 9) {
|
||||||
} else {
|
if ($input.val() != value) {
|
||||||
$div.remove();
|
parent.view.dataset.call(self.options.action_change, [parent.id, $input.val()]).then(function () {
|
||||||
|
parent.do_reload();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$div.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -13,6 +13,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
var value = _.pluck(self.field.value, 'value');
|
var value = _.pluck(self.field.value, 'value');
|
||||||
var tooltips = _.pluck(self.field.value, 'tooltip');
|
var tooltips = _.pluck(self.field.value, 'tooltip');
|
||||||
|
var suffix = self.options.tooltip_suffix || "";
|
||||||
var sparkline_options = _.extend({
|
var sparkline_options = _.extend({
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: 5,
|
barWidth: 5,
|
||||||
|
@ -20,14 +21,14 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten
|
||||||
barWidth: 4,
|
barWidth: 4,
|
||||||
barSpacing: 1,
|
barSpacing: 1,
|
||||||
barColor: '#96d854',
|
barColor: '#96d854',
|
||||||
|
tooltipFormat: '{{offset:offset}} {{value}} ' + suffix,
|
||||||
chartRangeMin: 0,
|
chartRangeMin: 0,
|
||||||
tooltipFormat: '{{offset:offset}} {{value}}',
|
|
||||||
tooltipValueLookups: {
|
tooltipValueLookups: {
|
||||||
'offset': tooltips
|
'offset': tooltips
|
||||||
}
|
}
|
||||||
}, self.options);
|
}, self.options);
|
||||||
self.$el.sparkline(value, sparkline_options);
|
self.$el.sparkline(value, sparkline_options);
|
||||||
self.$el.tipsy({'delayIn': 0, 'html': true, 'title': function(){return title}, 'gravity': 'n'});
|
self.$el.tipsy({'delayIn': self.options.delayIn || 0, 'html': true, 'title': function(){return title}, 'gravity': 'n'});
|
||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue