diff options
Diffstat (limited to 'web/app/view')
-rw-r--r-- | web/app/view/BaseEditDialog.js | 5 | ||||
-rw-r--r-- | web/app/view/BaseEditDialogController.js | 14 | ||||
-rw-r--r-- | web/app/view/DeviceDialog.js | 19 | ||||
-rw-r--r-- | web/app/view/DeviceDialogController.js | 38 | ||||
-rw-r--r-- | web/app/view/ServerDialog.js | 2 | ||||
-rw-r--r-- | web/app/view/UserDialog.js | 13 | ||||
-rw-r--r-- | web/app/view/UserDialogController.js | 20 |
7 files changed, 24 insertions, 87 deletions
diff --git a/web/app/view/BaseEditDialog.js b/web/app/view/BaseEditDialog.js index 051dfbe93..1af095c98 100644 --- a/web/app/view/BaseEditDialog.js +++ b/web/app/view/BaseEditDialog.js @@ -18,6 +18,11 @@ Ext.define('Traccar.view.BaseEditDialog', { extend: 'Traccar.view.BaseDialog', buttons: [{ + text: Strings.sharedAttributes, + handler: 'showAttributesView' + }, { + xtype: 'tbfill' + }, { text: Strings.sharedSave, handler: 'onSaveClick' }, { diff --git a/web/app/view/BaseEditDialogController.js b/web/app/view/BaseEditDialogController.js index 33bd01bd8..511309650 100644 --- a/web/app/view/BaseEditDialogController.js +++ b/web/app/view/BaseEditDialogController.js @@ -38,5 +38,19 @@ Ext.define('Traccar.view.BaseEditDialogController', { record.save(); } button.up('window').close(); + }, + + showAttributesView: function (button) { + var dialog, record; + dialog = button.up('window').down('form'); + record = dialog.getRecord(); + Ext.create('Traccar.view.BaseWindow', { + title: Strings.sharedAttributes, + modal: false, + items: { + xtype: 'attributesView', + record: record + } + }).show(); } }); diff --git a/web/app/view/DeviceDialog.js b/web/app/view/DeviceDialog.js index 2938d5dc3..e88618fc5 100644 --- a/web/app/view/DeviceDialog.js +++ b/web/app/view/DeviceDialog.js @@ -18,10 +18,10 @@ Ext.define('Traccar.view.DeviceDialog', { extend: 'Traccar.view.BaseEditDialog', requires: [ - 'Traccar.view.DeviceDialogController' + 'Traccar.view.BaseEditDialog' ], - controller: 'deviceDialog', + controller: 'baseEditDialog', title: Strings.deviceDialog, items: { @@ -45,18 +45,5 @@ Ext.define('Traccar.view.DeviceDialog', { displayField: 'name', valueField: 'id' }] - }, - - buttons: [{ - text : Strings.sharedAttributes, - handler: 'showAttributesView' - }, { - xtype: 'tbfill' - }, { - text: Strings.sharedSave, - handler: 'onSaveClick' - }, { - text: Strings.sharedCancel, - handler: 'closeView' - }] + } }); diff --git a/web/app/view/DeviceDialogController.js b/web/app/view/DeviceDialogController.js deleted file mode 100644 index 0a0f86883..000000000 --- a/web/app/view/DeviceDialogController.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -Ext.define('Traccar.view.DeviceDialogController', { - extend: 'Traccar.view.BaseEditDialogController', - alias: 'controller.deviceDialog', - - requires: [ - 'Traccar.view.Attributes' - ], - - showAttributesView: function (button) { - var dialog, record; - dialog = button.up('window').down('form'); - record = dialog.getRecord(); - Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedAttributes, - modal: false, - items: { - xtype: 'attributesView', - record: record - } - }).show(); - } -}); diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js index 67f3a7ab2..1af000042 100644 --- a/web/app/view/ServerDialog.js +++ b/web/app/view/ServerDialog.js @@ -31,7 +31,7 @@ Ext.define('Traccar.view.ServerDialog', { name: 'registration', fieldLabel: Strings.serverRegistration, allowBlank: false - },{ + }, { xtype: 'checkboxfield', name: 'readonly', fieldLabel: Strings.serverReadonly, diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js index 378cc0681..df8a26e7e 100644 --- a/web/app/view/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -89,18 +89,5 @@ Ext.define('Traccar.view.UserDialog', { fieldLabel: Strings.settingsTwelveHourFormat, allowBlank: false }] - }], - - buttons: [{ - text : Strings.sharedAttributes, - handler: 'showAttributesView' - }, { - xtype: 'tbfill' - }, { - text: Strings.sharedSave, - handler: 'onSaveClick' - }, { - text: Strings.sharedCancel, - handler: 'closeView' }] }); diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js index 49dfd9d70..c3a4ca62d 100644 --- a/web/app/view/UserDialogController.js +++ b/web/app/view/UserDialogController.js @@ -15,13 +15,9 @@ */ Ext.define('Traccar.view.UserDialogController', { - extend: 'Ext.app.ViewController', + extend: 'Traccar.view.BaseEditDialogController', alias: 'controller.userDialog', - requires: [ - 'Traccar.view.Attributes' - ], - init: function () { if (Traccar.app.getUser().get('admin')) { this.lookupReference('adminField').setDisabled(false); @@ -48,19 +44,5 @@ Ext.define('Traccar.view.UserDialogController', { }); } button.up('window').close(); - }, - - showAttributesView: function (button) { - var dialog, record; - dialog = button.up('window').down('form'); - record = dialog.getRecord(); - Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedAttributes, - modal: false, - items: { - xtype: 'attributesView', - record: record - } - }).show(); } }); |