aboutsummaryrefslogtreecommitdiff
path: root/web/app/AttributeFormatter.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-06 23:56:08 +1200
committerGitHub <noreply@github.com>2017-09-06 23:56:08 +1200
commit019fccd1bd4a123fe93228462b33f14889b23394 (patch)
tree5323e6bed0fcf18caa4847b47a2acecc9b060198 /web/app/AttributeFormatter.js
parentf819f04cc8fbc85c299ca647707364a2436d8987 (diff)
parentae877a48698f28beae82753feae9b4a8e0993ca2 (diff)
downloadtrackermap-web-019fccd1bd4a123fe93228462b33f14889b23394.tar.gz
trackermap-web-019fccd1bd4a123fe93228462b33f14889b23394.tar.bz2
trackermap-web-019fccd1bd4a123fe93228462b33f14889b23394.zip
Merge pull request #573 from Abyss777/units_attributes
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;