aboutsummaryrefslogtreecommitdiff
path: root/web/app/Application.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-16 19:45:57 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-16 19:45:57 +1200
commitc83cd82f605e93d17666ce5fd165552e56e21a31 (patch)
tree8795aaf5b88e2073a31120c6055cefe1cdac808b /web/app/Application.js
parent2c9cbb340ff17a8af0129ab7a4ffa9e535c26a22 (diff)
downloadtrackermap-server-c83cd82f605e93d17666ce5fd165552e56e21a31.tar.gz
trackermap-server-c83cd82f605e93d17666ce5fd165552e56e21a31.tar.bz2
trackermap-server-c83cd82f605e93d17666ce5fd165552e56e21a31.zip
Add attribute formatter class
Diffstat (limited to 'web/app/Application.js')
-rw-r--r--web/app/Application.js35
1 files changed, 3 insertions, 32 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index 93f197fb1..91d2b7835 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -20,7 +20,8 @@ Ext.define('Traccar.Application', {
requires: [
'Traccar.Resources',
- 'Traccar.ErrorManager'
+ 'Traccar.ErrorManager',
+ 'Traccar.AttributeFormatter'
],
models: [
@@ -68,36 +69,6 @@ Ext.define('Traccar.Application', {
getPreference: function(key, defaultValue) {
return this.getUser().get('distanceUnit') | this.getServer().get('distanceUnit') | defaultValue;
- },
-
- getRenderer: function(key) {
- if (key === 'latitude' || key === 'longitude') {
- return function(value) {
- return value.toFixed(5);
- }
- } else if (key === 'speed') {
- return function(value) {
- return Ext.getStore('SpeedUnits').formatValue(value, this.getPreference('speedUnit'));
- }
- } else if (key === 'course') {
- return function(value) {
- var directions = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
- return directions[Math.floor(value / 45)];
- }
- } else if (key === 'distance' || key === 'odometer') {
- return function(value) {
- return Ext.getStore('DistanceUnits').formatValue(value, this.getPreference('distanceUnit'));
- }
- } else {
- return function(value) {
- if (value instanceof Number) {
- return value.toFixed(2);
- } else if (value instanceof Date) {
- return Ext.Date.format(value, styles.dateTimeFormat);
- }
- return value;
- }
- }
}
-
+
});