aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-09 13:26:33 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-09 13:26:33 +1200
commitfe7b8bd58e23e289a041bc7c9a5d6c37f085419a (patch)
treed28b58d1ea3b4fcd6c715c4f2d2e2e04cb91c208 /web/app/view
parent70d22de4205aec294660378f0d854cbc32c7a6b8 (diff)
downloadtrackermap-server-fe7b8bd58e23e289a041bc7c9a5d6c37f085419a.tar.gz
trackermap-server-fe7b8bd58e23e289a041bc7c9a5d6c37f085419a.tar.bz2
trackermap-server-fe7b8bd58e23e289a041bc7c9a5d6c37f085419a.zip
Fix issues in JavaScript code
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/AttributesController.js25
-rw-r--r--web/app/view/BaseMap.js2
-rw-r--r--web/app/view/BasePermissionsController.js6
-rw-r--r--web/app/view/DevicesController.js10
-rw-r--r--web/app/view/GeofenceMap.js4
-rw-r--r--web/app/view/GroupsController.js7
-rw-r--r--web/app/view/Notifications.js9
-rw-r--r--web/app/view/NotificationsController.js9
8 files changed, 39 insertions, 33 deletions
diff --git a/web/app/view/AttributesController.js b/web/app/view/AttributesController.js
index 663b6eae3..3028e41eb 100644
--- a/web/app/view/AttributesController.js
+++ b/web/app/view/AttributesController.js
@@ -24,29 +24,32 @@ Ext.define('Traccar.view.AttributesController', {
],
init: function () {
- var store, propertyName, i = 0;
+ var store, propertyName, i = 0, attributes;
store = Ext.create('Traccar.store.Attributes');
store.setProxy(Ext.create('Ext.data.proxy.Memory'));
- for (propertyName in this.getView().record.get('attributes')) {
- store.add(Ext.create('Traccar.model.Attribute', {
- priority: i++,
- name: propertyName,
- value:this.getView().record.get('attributes')[propertyName]
- }));
+ attributes = this.getView().record.get('attributes');
+ for (propertyName in attributes) {
+ if (attributes.hasOwnProperty(propertyName)) {
+ store.add(Ext.create('Traccar.model.Attribute', {
+ priority: i++,
+ name: propertyName,
+ value: this.getView().record.get('attributes')[propertyName]
+ }));
+ }
}
- store.addListener('add', function (store , records , index , eOpts) {
- for (var i = 0; i < records.length; i++) {
+ store.addListener('add', function (store, records, index, eOpts) {
+ for (i = 0; i < records.length; i++) {
this.getView().record.get('attributes')[records[i].get('name')] = records[i].get('value');
this.getView().record.dirty = true;
}
}, this);
- store.addListener('update', function (store, record, operation , modifiedFieldNames , details , eOpts) {
+ store.addListener('update', function (store, record, operation, modifiedFieldNames, details, eOpts) {
if (operation === Ext.data.Model.EDIT) {
this.getView().record.get('attributes')[record.get('name')] = record.get('value');
this.getView().record.dirty = true;
}
}, this);
- store.addListener('remove', function (store , records , index , isMove , eOpts) {
+ store.addListener('remove', function (store, records, index, isMove, eOpts) {
delete this.getView().record.get('attributes')[records[index].get('name')];
this.getView().record.dirty = true;
}, this);
diff --git a/web/app/view/BaseMap.js b/web/app/view/BaseMap.js
index 7f508cbe8..77646cbef 100644
--- a/web/app/view/BaseMap.js
+++ b/web/app/view/BaseMap.js
@@ -28,7 +28,7 @@ Ext.define('Traccar.view.BaseMap', {
return this.mapView;
},
- initMap: function() {
+ initMap: function () {
var user, server, layer, type, bingKey, lat, lon, zoom, target;
user = Traccar.app.getUser();
diff --git a/web/app/view/BasePermissionsController.js b/web/app/view/BasePermissionsController.js
index 713d91770..3cdc2e4dc 100644
--- a/web/app/view/BasePermissionsController.js
+++ b/web/app/view/BasePermissionsController.js
@@ -19,10 +19,10 @@ Ext.define('Traccar.view.BasePermissionsController', {
alias: 'controller.basePermissionsController',
init: function () {
- var params = {};
+ var params = {}, linkStoreName, storeName;
params[this.getView().baseObjectName] = this.getView().baseObject;
- var linkStoreName = this.getView().linkStoreName;
- var storeName = this.getView().storeName;
+ linkStoreName = this.getView().linkStoreName;
+ storeName = this.getView().storeName;
linkStoreName = (typeof linkStoreName === 'undefined') ? storeName : linkStoreName;
this.getView().setStore(Ext.getStore(storeName));
this.getView().getStore().load({
diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js
index cf31dd7bb..c61f8711b 100644
--- a/web/app/view/DevicesController.js
+++ b/web/app/view/DevicesController.js
@@ -86,15 +86,16 @@ Ext.define('Traccar.view.DevicesController', {
},
onGeofencesClick: function () {
- var admin = Traccar.app.getUser().get('admin');
- var device = this.getView().getSelectionModel().getSelection()[0];
+ var admin, device;
+ admin = Traccar.app.getUser().get('admin');
+ device = this.getView().getSelectionModel().getSelection()[0];
Ext.create('Traccar.view.BaseWindow', {
title: Strings.sharedGeofences,
items: {
xtype: 'deviceGeofencesView',
baseObjectName: 'deviceId',
linkObjectName: 'geofenceId',
- storeName: (admin) ? 'AllGeofences' : 'Geofences',
+ storeName: admin ? 'AllGeofences' : 'Geofences',
urlApi: '/api/devices/geofences',
baseObject: device.getData().id
}
@@ -115,8 +116,9 @@ Ext.define('Traccar.view.DevicesController', {
},
onFollowClick: function (button, pressed) {
+ var device;
if (pressed) {
- var device = this.getView().getSelectionModel().getSelection()[0];
+ device = this.getView().getSelectionModel().getSelection()[0];
this.fireEvent('selectDevice', device, true);
}
},
diff --git a/web/app/view/GeofenceMap.js b/web/app/view/GeofenceMap.js
index 165daf40d..573836bc9 100644
--- a/web/app/view/GeofenceMap.js
+++ b/web/app/view/GeofenceMap.js
@@ -57,7 +57,7 @@ Ext.define('Traccar.view.GeofenceMap', {
map = this.map;
this.features = new ol.Collection();
- if (this.area !== "") {
+ if (this.area !== '') {
geometry = Traccar.GeofenceConverter.wktToGeometry(this.mapView, this.area);
this.features.push(new ol.Feature(geometry));
if (geometry instanceof ol.geom.Circle) {
@@ -90,7 +90,7 @@ Ext.define('Traccar.view.GeofenceMap', {
map.addInteraction(new ol.interaction.Modify({
features: this.features,
- deleteCondition: function(event) {
+ deleteCondition: function (event) {
return ol.events.condition.shiftKeyOnly(event) && ol.events.condition.singleClick(event);
}
}));
diff --git a/web/app/view/GroupsController.js b/web/app/view/GroupsController.js
index bc713bb6d..1764423d7 100644
--- a/web/app/view/GroupsController.js
+++ b/web/app/view/GroupsController.js
@@ -60,15 +60,16 @@ Ext.define('Traccar.view.GroupsController', {
},
onGeofencesClick: function () {
- var admin = Traccar.app.getUser().get('admin');
- var group = this.getView().getSelectionModel().getSelection()[0];
+ var admin, group;
+ admin = Traccar.app.getUser().get('admin');
+ group = this.getView().getSelectionModel().getSelection()[0];
Ext.create('Traccar.view.BaseWindow', {
title: Strings.sharedGeofences,
items: {
xtype: 'groupGeofencesView',
baseObjectName: 'groupId',
linkObjectName: 'geofenceId',
- storeName: (admin) ? 'AllGeofences' : 'Geofences',
+ storeName: admin ? 'AllGeofences' : 'Geofences',
urlApi: '/api/groups/geofences',
baseObject: group.getData().id
}
diff --git a/web/app/view/Notifications.js b/web/app/view/Notifications.js
index 211e5cd15..92a850671 100644
--- a/web/app/view/Notifications.js
+++ b/web/app/view/Notifications.js
@@ -26,7 +26,7 @@ Ext.define('Traccar.view.Notifications', {
store: 'AllNotifications',
selModel: {
- selType: 'cellmodel',
+ selType: 'cellmodel'
},
columns: [{
@@ -47,7 +47,7 @@ Ext.define('Traccar.view.Notifications', {
checkChange: 'onCheckChange'
},
renderer: function (value, metaData, record) {
- var fields = this.dataIndex.split('\.',2);
+ var fields = this.dataIndex.split('\.', 2);
return (new Ext.ux.CheckColumn()).renderer(record.get(fields[0])[fields[1]], metaData);
}
}, {
@@ -60,9 +60,8 @@ Ext.define('Traccar.view.Notifications', {
checkChange: 'onCheckChange'
},
renderer: function (value, metaData, record) {
- var fields = this.dataIndex.split('\.',2);
+ var fields = this.dataIndex.split('\.', 2);
return (new Ext.ux.CheckColumn()).renderer(record.get(fields[0])[fields[1]], metaData);
}
- }],
-
+ }]
});
diff --git a/web/app/view/NotificationsController.js b/web/app/view/NotificationsController.js
index a7c4290ca..90479fe07 100644
--- a/web/app/view/NotificationsController.js
+++ b/web/app/view/NotificationsController.js
@@ -47,11 +47,12 @@ Ext.define('Traccar.view.NotificationsController', {
},
onBeforeCheckChange: function (column, rowIndex, checked, eOpts) {
- var fields = column.dataIndex.split('\.',2);
- var record = this.getView().getStore().getAt(rowIndex);
- var data = record.get(fields[0]);
+ var fields, record, data;
+ fields = column.dataIndex.split('\.', 2);
+ record = this.getView().getStore().getAt(rowIndex);
+ data = record.get(fields[0]);
if (!data[fields[1]]) {
- data[fields[1]] = "true";
+ data[fields[1]] = 'true';
} else {
delete data[fields[1]];
}