aboutsummaryrefslogtreecommitdiff
path: root/web/app/AttributeFormatter.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-09-06 13:28:48 +0500
committerAbyss777 <abyss@fox5.ru>2017-09-06 14:59:08 +0500
commit1edfec60e54b26f3cd7970075b58bb69920b37f7 (patch)
treed7ecca927798e16c469868fc609c954fe3d1016c /web/app/AttributeFormatter.js
parentae9de5a7b9cf43ad488022675d243a4b7a863aa4 (diff)
downloadtrackermap-web-1edfec60e54b26f3cd7970075b58bb69920b37f7.tar.gz
trackermap-web-1edfec60e54b26f3cd7970075b58bb69920b37f7.tar.bz2
trackermap-web-1edfec60e54b26f3cd7970075b58bb69920b37f7.zip
Move units to attributes and add volume units
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r--web/app/AttributeFormatter.js24
1 files changed, 18 insertions, 6 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index abe0f485..8a9e3dca 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -32,11 +32,11 @@ Ext.define('Traccar.AttributeFormatter', {
},
speedFormatter: function (value) {
- return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit'));
+ return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getAttributePreference('speedUnit'));
},
speedConverter: function (value) {
- return Ext.getStore('SpeedUnits').convertValue(value, Traccar.app.getPreference('speedUnit'));
+ return Ext.getStore('SpeedUnits').convertValue(value, Traccar.app.getAttributePreference('speedUnit'));
},
courseFormatter: function (value) {
@@ -45,11 +45,19 @@ Ext.define('Traccar.AttributeFormatter', {
},
distanceFormatter: function (value) {
- return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit'));
+ return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getAttributePreference('distanceUnit'));
},
distanceConverter: function (value) {
- return Ext.getStore('DistanceUnits').convertValue(value, Traccar.app.getPreference('distanceUnit'));
+ return Ext.getStore('DistanceUnits').convertValue(value, Traccar.app.getAttributePreference('distanceUnit'));
+ },
+
+ volumeFormatter: function (value) {
+ return Ext.getStore('VolumeUnits').formatValue(value, Traccar.app.getAttributePreference('volumeUnit'));
+ },
+
+ volumeConverter: function (value) {
+ return Ext.getStore('VolumeUnits').convertValue(value, Traccar.app.getAttributePreference('volumeUnit'));
},
durationFormatter: function (value) {
@@ -164,7 +172,7 @@ Ext.define('Traccar.AttributeFormatter', {
case 'lastUpdate':
return this.lastUpdateFormatter;
case 'spentFuel':
- return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterAbbreviation);
+ return this.volumeFormatter;
case 'driverUniqueId':
return this.driverUniqueIdFormatter;
default:
@@ -179,6 +187,8 @@ Ext.define('Traccar.AttributeFormatter', {
case 'distance':
case 'accuracy':
return this.distanceConverter;
+ case 'spentFuel':
+ return this.volumeConverter;
default:
return function (value) {
return value;
@@ -203,7 +213,7 @@ Ext.define('Traccar.AttributeFormatter', {
case 'temperature':
return this.numberFormatterFactory(Traccar.Style.numberPrecision, '&deg;C');
case 'volume':
- return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterAbbreviation);
+ return this.volumeFormatter;
case 'consumption':
return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterPerHourAbbreviation);
default:
@@ -219,6 +229,8 @@ Ext.define('Traccar.AttributeFormatter', {
return this.distanceConverter;
case 'speed':
return this.speedConverter;
+ case 'volume':
+ return this.volumeConverter;
default:
return function (value) {
return value;