From 62a584aea59666bd95d0a88e917f24fe5999df16 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 8 Apr 2016 12:03:27 +1200 Subject: Add knots option for speed value --- web/app/store/DistanceUnits.js | 9 ++++----- web/app/store/SpeedUnits.js | 13 ++++++++----- web/l10n/en.json | 1 + 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'web') diff --git a/web/app/store/DistanceUnits.js b/web/app/store/DistanceUnits.js index 29c4f28e0..2805d52f0 100644 --- a/web/app/store/DistanceUnits.js +++ b/web/app/store/DistanceUnits.js @@ -30,11 +30,10 @@ Ext.define('Traccar.store.DistanceUnits', { formatValue: function (value, unit) { var model; - if (unit) { - model = this.findRecord('key', unit); - return (value * model.get('factor')).toFixed(2) + ' ' + model.get('name'); - } else { - return value; + if (!unit) { + unit = 'km'; } + model = this.findRecord('key', unit); + return (value * model.get('factor')).toFixed(2) + ' ' + model.get('name'); } }); diff --git a/web/app/store/SpeedUnits.js b/web/app/store/SpeedUnits.js index d02892a01..296f58636 100644 --- a/web/app/store/SpeedUnits.js +++ b/web/app/store/SpeedUnits.js @@ -19,6 +19,10 @@ Ext.define('Traccar.store.SpeedUnits', { fields: ['key', 'name', 'factor'], data: [{ + key: 'kn', + name: Strings.sharedKn, + factor: 1 + }, { key: 'kmh', name: Strings.sharedKmh, factor: 1.852 @@ -30,11 +34,10 @@ Ext.define('Traccar.store.SpeedUnits', { formatValue: function (value, unit) { var model; - if (unit) { - model = this.findRecord('key', unit); - return (value * model.get('factor')).toFixed(1) + ' ' + model.get('name'); - } else { - return value; + if (!unit) { + unit = 'kn'; } + model = this.findRecord('key', unit); + return (value * model.get('factor')).toFixed(1) + ' ' + model.get('name'); } }); diff --git a/web/l10n/en.json b/web/l10n/en.json index 4fb72c670..141ea5b96 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -8,6 +8,7 @@ "sharedRemoveConfirm": "Remove item?", "sharedKm": "km", "sharedMi": "mi", + "sharedKn": "kn", "sharedKmh": "km/h", "sharedMph": "mph", "sharedHour": "Hour", -- cgit v1.2.3