aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-16 22:27:23 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-16 22:27:23 +1200
commite7187ea46a8ca8a0e8d93a030a9d360249b998fa (patch)
tree23f3473ce938b31f062b3a0ca469542254daf74d
parent37f402a3afae13ade44e135ab4ca3e4cf4966425 (diff)
downloadtrackermap-server-e7187ea46a8ca8a0e8d93a030a9d360249b998fa.tar.gz
trackermap-server-e7187ea46a8ca8a0e8d93a030a9d360249b998fa.tar.bz2
trackermap-server-e7187ea46a8ca8a0e8d93a030a9d360249b998fa.zip
Fix attribute formatter functions
-rw-r--r--web/app/Application.js2
-rw-r--r--web/app/AttributeFormatter.js11
-rw-r--r--web/app/view/login/Login.js2
-rw-r--r--web/app/view/report/Report.js6
4 files changed, 12 insertions, 9 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index 91d2b7835..c488818a4 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -68,7 +68,7 @@ Ext.define('Traccar.Application', {
},
getPreference: function(key, defaultValue) {
- return this.getUser().get('distanceUnit') | this.getServer().get('distanceUnit') | defaultValue;
+ return this.getUser().get(key) || this.getServer().get(key) || defaultValue;
}
});
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index 294fdaaba..ba77c2072 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -18,17 +18,16 @@ Ext.define('Traccar.AttributeFormatter', {
singleton: true,
coordinateFormatter: function(value) {
- return value.toFixed(5);
+ return value.toFixed(6);
},
speedFormatter: function(value) {
return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit'));
},
- courseValues: ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'],
-
courseFormatter: function(value) {
- return this.courseValues[Math.floor(value / 45)];
+ var courseValues = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
+ return courseValues[Math.floor(value / 45)];
},
distanceFormatter: function(value) {
@@ -36,8 +35,10 @@ Ext.define('Traccar.AttributeFormatter', {
},
defaultFormatter: function(value) {
- if (value instanceof Number) {
+ if (typeof value === 'number') {
return value.toFixed(2);
+ } else if (typeof value === 'boolean') {
+ return value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no;
} else if (value instanceof Date) {
return Ext.Date.format(value, styles.dateTimeFormat);
}
diff --git a/web/app/view/login/Login.js b/web/app/view/login/Login.js
index adb04cf0c..fc1e749d1 100644
--- a/web/app/view/login/Login.js
+++ b/web/app/view/login/Login.js
@@ -35,7 +35,7 @@ Ext.define('Traccar.view.login.Login', {
autoEl: {
tag: 'form',
method: 'POST',
- action: 'blank.html',
+ action: 'blank',
target: 'submitTarget'
},
diff --git a/web/app/view/report/Report.js b/web/app/view/report/Report.js
index 25f3b244a..720de698f 100644
--- a/web/app/view/report/Report.js
+++ b/web/app/view/report/Report.js
@@ -81,7 +81,8 @@ Ext.define('Traccar.view.report.Report', {
columns: [{
text: strings.positionValid,
dataIndex: 'valid',
- flex: 1
+ flex: 1,
+ renderer: Traccar.AttributeFormatter.getFormatter('valid')
}, {
text: strings.positionTime,
dataIndex: 'fixTime',
@@ -111,6 +112,7 @@ Ext.define('Traccar.view.report.Report', {
}, {
text: strings.positionAddress,
dataIndex: 'address',
- flex: 1
+ flex: 1,
+ renderer: Traccar.AttributeFormatter.getFormatter('address')
}]
});