aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-16 22:45:14 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-16 22:45:14 +1200
commit4154c2cd31f23c5d5fb336dfcd68ba192b297f93 (patch)
treeb1178bbc26479f580606e8a70a1004a8cea46522 /web/app/view
parent607522a21625610248db7a586e6285bbb0331391 (diff)
downloadtrackermap-server-4154c2cd31f23c5d5fb336dfcd68ba192b297f93.tar.gz
trackermap-server-4154c2cd31f23c5d5fb336dfcd68ba192b297f93.tar.bz2
trackermap-server-4154c2cd31f23c5d5fb336dfcd68ba192b297f93.zip
More JavaScript code cleanup
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/device/Device.js11
-rw-r--r--web/app/view/device/DeviceController.js28
-rw-r--r--web/app/view/login/LoginController.js2
-rw-r--r--web/app/view/map/Map.js4
-rw-r--r--web/app/view/user/UserDialogController.js4
5 files changed, 27 insertions, 22 deletions
diff --git a/web/app/view/device/Device.js b/web/app/view/device/Device.js
index 9cb2123dd..d77f405bd 100644
--- a/web/app/view/device/Device.js
+++ b/web/app/view/device/Device.js
@@ -82,9 +82,12 @@ Ext.define('Traccar.view.device.Device', {
selectionchange: 'onSelectionChange'
},
- columns: [
- { text: strings.deviceName, dataIndex: 'name', flex: 1 },
- { text: strings.deviceIdentifier, dataIndex: 'uniqueId', flex: 1 }
- ]
+ columns: [{
+ text: strings.deviceName,
+ dataIndex: 'name', flex: 1
+ }, {
+ text: strings.deviceIdentifier,
+ dataIndex: 'uniqueId', flex: 1
+ }]
});
diff --git a/web/app/view/device/DeviceController.js b/web/app/view/device/DeviceController.js
index 31caa5147..59b777f8b 100644
--- a/web/app/view/device/DeviceController.js
+++ b/web/app/view/device/DeviceController.js
@@ -37,7 +37,7 @@ Ext.define('Traccar.view.device.DeviceController', {
},
init: function() {
- if (Traccar.getApplication().getUser().get('admin')) {
+ if (Traccar.app.getUser().get('admin')) {
this.lookupReference('settingsServerButton').setHidden(false);
this.lookupReference('settingsUsersButton').setHidden(false);
}
@@ -48,15 +48,17 @@ Ext.define('Traccar.view.device.DeviceController', {
},
onAddClick: function() {
- var device = Ext.create('Traccar.model.Device');
- var dialog = Ext.create('Traccar.view.device.DeviceDialog');
+ var device, dialog;
+ device = Ext.create('Traccar.model.Device');
+ dialog = Ext.create('Traccar.view.device.DeviceDialog');
dialog.down('form').loadRecord(device);
dialog.show();
},
onEditClick: function() {
- var device = this.getView().getSelectionModel().getSelection()[0];
- var dialog = Ext.create('Traccar.view.device.DeviceDialog');
+ var device, dialog;
+ device = this.getView().getSelectionModel().getSelection()[0];
+ dialog = Ext.create('Traccar.view.device.DeviceDialog');
dialog.down('form').loadRecord(device);
dialog.show();
},
@@ -72,8 +74,9 @@ Ext.define('Traccar.view.device.DeviceController', {
no: strings.sharedCancel
},
fn: function(btn) {
+ var store;
if (btn === 'yes') {
- var store = Ext.getStore('Devices');
+ store = Ext.getStore('Devices');
store.remove(device);
store.sync();
}
@@ -82,10 +85,11 @@ Ext.define('Traccar.view.device.DeviceController', {
},
onCommandClick: function() {
- var device = this.getView().getSelectionModel().getSelection()[0];
- var command = Ext.create('Traccar.model.Command');
+ var device, command, dialog;
+ device = this.getView().getSelectionModel().getSelection()[0];
+ command = Ext.create('Traccar.model.Command');
command.set('deviceId', device.get('id'));
- var dialog = Ext.create('Traccar.view.command.CommandDialog');
+ dialog = Ext.create('Traccar.view.command.CommandDialog');
dialog.down('form').loadRecord(command);
dialog.show();
},
@@ -101,16 +105,14 @@ Ext.define('Traccar.view.device.DeviceController', {
},
onUserClick: function() {
- var user = Traccar.getApplication().getUser();
var dialog = Ext.create('Traccar.view.user.UserDialog');
- dialog.down('form').loadRecord(user);
+ dialog.down('form').loadRecord(Traccar.app.getUser());
dialog.show();
},
onServerClick: function() {
- var server = Traccar.getApplication().getServer();
var dialog = Ext.create('Traccar.view.admin.ServerDialog');
- dialog.down('form').loadRecord(server);
+ dialog.down('form').loadRecord(Traccar.app.getServer());
dialog.show();
},
diff --git a/web/app/view/login/LoginController.js b/web/app/view/login/LoginController.js
index e809b0fbc..48a4aa0f7 100644
--- a/web/app/view/login/LoginController.js
+++ b/web/app/view/login/LoginController.js
@@ -24,7 +24,7 @@ Ext.define('Traccar.view.login.LoginController', {
init: function() {
this.lookupReference('registerButton').setDisabled(
- !Traccar.getApplication().getServer().get('registration')
+ !Traccar.app.getServer().get('registration')
);
this.lookupReference('languageField').setValue(language);
diff --git a/web/app/view/map/Map.js b/web/app/view/map/Map.js
index e70af0918..6e8ab6fad 100644
--- a/web/app/view/map/Map.js
+++ b/web/app/view/map/Map.js
@@ -30,8 +30,8 @@ Ext.define('Traccar.view.map.Map', {
listeners: {
afterrender: function() {
- var user = Traccar.getApplication().getUser();
- var server = Traccar.getApplication().getServer();
+ var user = Traccar.app.getUser();
+ var server = Traccar.app.getServer();
var layer;
var mapLayer = user.get('map') || server.get('map');
diff --git a/web/app/view/user/UserDialogController.js b/web/app/view/user/UserDialogController.js
index cd37f70cf..dd3109d37 100644
--- a/web/app/view/user/UserDialogController.js
+++ b/web/app/view/user/UserDialogController.js
@@ -19,7 +19,7 @@ Ext.define('Traccar.view.user.UserDialogController', {
alias: 'controller.userDialog',
init: function() {
- if (Traccar.getApplication().getUser().get('admin')) {
+ if (Traccar.app.getUser().get('admin')) {
this.lookupReference('adminField').setDisabled(false);
}
},
@@ -28,7 +28,7 @@ Ext.define('Traccar.view.user.UserDialogController', {
var dialog = button.up('window').down('form');
dialog.updateRecord();
var record = dialog.getRecord();
- if (record === Traccar.getApplication().getUser()) {
+ if (record === Traccar.app.getUser()) {
record.save();
} else {
var store = Ext.getStore('Users');