diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-03 20:39:14 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-03 20:39:14 +1300 |
commit | d16121684ecae7646aa87616a64d60978d087bc0 (patch) | |
tree | 69a02f798950bc9ee54e33cdf8ae09fed40168e4 | |
parent | 8782eeec561e490b4262ba8983e69623daaf5845 (diff) | |
download | traccar-server-d16121684ecae7646aa87616a64d60978d087bc0.tar.gz traccar-server-d16121684ecae7646aa87616a64d60978d087bc0.tar.bz2 traccar-server-d16121684ecae7646aa87616a64d60978d087bc0.zip |
Move remaining classes to view
-rw-r--r-- | web/.jscsrc | 3 | ||||
-rw-r--r-- | web/app/ErrorManager.js | 5 | ||||
-rw-r--r-- | web/app/LoginManager.js | 8 | ||||
-rw-r--r-- | web/app/store/Languages.js | 8 | ||||
-rw-r--r-- | web/app/view/DeviceController.js | 6 | ||||
-rw-r--r-- | web/app/view/Map.js | 6 | ||||
-rw-r--r-- | web/app/view/User.js (renamed from web/app/view/user/User.js) | 9 | ||||
-rw-r--r-- | web/app/view/UserController.js (renamed from web/app/view/user/UserController.js) | 16 | ||||
-rw-r--r-- | web/app/view/UserDialog.js (renamed from web/app/view/user/UserDialog.js) | 24 | ||||
-rw-r--r-- | web/app/view/UserDialogController.js (renamed from web/app/view/user/UserDialogController.js) | 7 |
10 files changed, 37 insertions, 55 deletions
diff --git a/web/.jscsrc b/web/.jscsrc index ac17b5dc9..7d924ab96 100644 --- a/web/.jscsrc +++ b/web/.jscsrc @@ -1,3 +1,4 @@ { - "preset": "crockford" + "preset": "crockford", + "maxErrors": 100 } diff --git a/web/app/ErrorManager.js b/web/app/ErrorManager.js index e8b29a319..e809fa382 100644 --- a/web/app/ErrorManager.js +++ b/web/app/ErrorManager.js @@ -16,10 +16,11 @@ Ext.define('Traccar.ErrorManager', { singleton: true, - + check: function (success, response) { + var result; if (success) { - var result = Ext.decode(response.responseText); + result = Ext.decode(response.responseText); if (result.success || result.error === undefined) { return true; } else { diff --git a/web/app/LoginManager.js b/web/app/LoginManager.js index 5a9615183..07445fc15 100644 --- a/web/app/LoginManager.js +++ b/web/app/LoginManager.js @@ -16,7 +16,7 @@ Ext.define('Traccar.LoginManager', { singleton: true, - + server: function (options) { Ext.Ajax.request({ scope: this, @@ -45,16 +45,16 @@ Ext.define('Traccar.LoginManager', { original: options }); }, - + onSessionReturn: function (options, success, response) { + var result; options = options.original; if (Traccar.ErrorManager.check(success, response)) { - var result = Ext.decode(response.responseText); + result = Ext.decode(response.responseText); if (result.success) { Traccar.app.setUser(result.data); } Ext.callback(options.callback, options.scope, [result.success]); } } - }); diff --git a/web/app/store/Languages.js b/web/app/store/Languages.js index 658b7bc21..22685173a 100644 --- a/web/app/store/Languages.js +++ b/web/app/store/Languages.js @@ -18,9 +18,9 @@ Ext.define('Traccar.store.Languages', { extend: 'Ext.data.Store', fields: ['code', 'name'], - data: function () { - var data = []; - for (var code in availableLanguages) { + data: (function () { + var code, data = []; + for (code in availableLanguages) { if (availableLanguages.hasOwnProperty(code)) { data.push({ code: code, @@ -29,5 +29,5 @@ Ext.define('Traccar.store.Languages', { } } return data; - }() + }()) }); diff --git a/web/app/view/DeviceController.js b/web/app/view/DeviceController.js index 64b3b8826..2e2fdb2a6 100644 --- a/web/app/view/DeviceController.js +++ b/web/app/view/DeviceController.js @@ -21,8 +21,8 @@ Ext.define('Traccar.view.DeviceController', { requires: [ 'Traccar.view.CommandDialog', 'Traccar.view.DeviceDialog', - 'Traccar.view.user.UserDialog', - 'Traccar.view.user.User', + 'Traccar.view.UserDialog', + 'Traccar.view.User', 'Traccar.view.LoginController' ], @@ -106,7 +106,7 @@ Ext.define('Traccar.view.DeviceController', { }, onUserClick: function () { - var dialog = Ext.create('Traccar.view.user.UserDialog'); + var dialog = Ext.create('Traccar.view.UserDialog'); dialog.down('form').loadRecord(Traccar.app.getUser()); dialog.show(); }, diff --git a/web/app/view/Map.js b/web/app/view/Map.js index 63be7f666..f7a763b9d 100644 --- a/web/app/view/Map.js +++ b/web/app/view/Map.js @@ -29,7 +29,6 @@ Ext.define('Traccar.view.Map', { listeners: { afterrender: function () { - var user = Traccar.app.getUser(); var server = Traccar.app.getServer(); @@ -67,14 +66,14 @@ Ext.define('Traccar.view.Map', { var zoom = user.get('zoom') || server.get('zoom') || styles.mapDefaultZoom; this.mapView = new ol.View({ - center: ol.proj.fromLonLat([ lon, lat ]), + center: ol.proj.fromLonLat([lon, lat]), zoom: zoom, maxZoom: styles.mapMaxZoom }); this.map = new ol.Map({ target: this.body.dom.id, - layers: [ layer, vectorLayer ], + layers: [layer, vectorLayer], view: this.mapView }); }, @@ -83,5 +82,4 @@ Ext.define('Traccar.view.Map', { this.map.updateSize(); } } - }); diff --git a/web/app/view/user/User.js b/web/app/view/User.js index b5d216aea..807095ebe 100644 --- a/web/app/view/user/User.js +++ b/web/app/view/User.js @@ -14,19 +14,19 @@ * limitations under the License. */ -Ext.define('Traccar.view.user.User', { +Ext.define('Traccar.view.User', { extend: 'Ext.grid.Panel', xtype: 'userView', requires: [ - 'Traccar.view.user.UserController' + 'Traccar.view.UserController' ], - + controller: 'user', store: 'Users', selType: 'rowmodel', - + tbar: [{ text: strings.sharedAdd, handler: 'onAddClick', @@ -57,5 +57,4 @@ Ext.define('Traccar.view.user.User', { { text: strings.userEmail, dataIndex: 'email', flex: 1 }, { text: strings.userAdmin, dataIndex: 'admin', flex: 1 } ] - }); diff --git a/web/app/view/user/UserController.js b/web/app/view/UserController.js index 507fd5a5c..f541914e4 100644 --- a/web/app/view/user/UserController.js +++ b/web/app/view/UserController.js @@ -14,12 +14,12 @@ * limitations under the License. */ -Ext.define('Traccar.view.user.UserController', { +Ext.define('Traccar.view.UserController', { extend: 'Ext.app.ViewController', alias: 'controller.user', - + requires: [ - 'Traccar.view.user.UserDialog' + 'Traccar.view.UserDialog' ], init: function () { @@ -28,18 +28,18 @@ Ext.define('Traccar.view.user.UserController', { onAddClick: function () { var user = Ext.create('Traccar.model.User'); - var dialog = Ext.create('Traccar.view.user.UserDialog'); + var dialog = Ext.create('Traccar.view.UserDialog'); dialog.down('form').loadRecord(user); dialog.show(); }, - + onEditClick: function () { var user = this.getView().getSelectionModel().getSelection()[0]; - var dialog = Ext.create('Traccar.view.user.UserDialog'); + var dialog = Ext.create('Traccar.view.UserDialog'); dialog.down('form').loadRecord(user); dialog.show(); }, - + onRemoveClick: function () { var user = this.getView().getSelectionModel().getSelection()[0]; Ext.Msg.show({ @@ -73,7 +73,7 @@ Ext.define('Traccar.view.user.UserController', { } }).show();*/ }, - + onSelectionChange: function (selected) { var disabled = selected.length > 0; this.lookupReference('userEditButton').setDisabled(disabled); diff --git a/web/app/view/user/UserDialog.js b/web/app/view/UserDialog.js index d1bc68f96..0c5914ce0 100644 --- a/web/app/view/user/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -14,20 +14,17 @@ * limitations under the License. */ -Ext.define('Traccar.view.user.UserDialog', { - extend: 'Ext.window.Window', +Ext.define('Traccar.view.UserDialog', { + extend: 'Traccar.view.BaseEditDialog', requires: [ - 'Traccar.view.user.UserDialogController' + 'Traccar.view.UserDialogController' ], controller: 'userDialog', - - bodyPadding: styles.panelPadding, + title: strings.settingsUser, - resizable: false, - modal: true, - + items: { xtype: 'form', items: [{ @@ -86,14 +83,5 @@ Ext.define('Traccar.view.user.UserDialog', { name: 'zoom', fieldLabel: strings.serverZoom }] - }, - - buttons: [{ - text: strings.sharedSave, - handler: 'onSaveClick' - }, { - text: strings.sharedCancel, - handler: 'onCancelClick' - }] - + } }); diff --git a/web/app/view/user/UserDialogController.js b/web/app/view/UserDialogController.js index 40f938b5c..0bd9d87e3 100644 --- a/web/app/view/user/UserDialogController.js +++ b/web/app/view/UserDialogController.js @@ -14,7 +14,7 @@ * limitations under the License. */ -Ext.define('Traccar.view.user.UserDialogController', { +Ext.define('Traccar.view.UserDialogController', { extend: 'Ext.app.ViewController', alias: 'controller.userDialog', @@ -43,10 +43,5 @@ Ext.define('Traccar.view.user.UserDialogController', { }); } button.up('window').close(); - }, - - onCancelClick: function (button) { - button.up('window').close(); } - }); |