diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-21 16:14:57 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-21 16:14:57 +1200 |
commit | 1bd459e27af45dda6011d113cc0e49fe79cb673d (patch) | |
tree | 63af4927bfc4b98169d2f7979b9ec0acef7a30e9 | |
parent | 992a1530ef1636025932b67aab1ba7cfaabce9e3 (diff) | |
download | trackermap-server-1bd459e27af45dda6011d113cc0e49fe79cb673d.tar.gz trackermap-server-1bd459e27af45dda6011d113cc0e49fe79cb673d.tar.bz2 trackermap-server-1bd459e27af45dda6011d113cc0e49fe79cb673d.zip |
Refactor server dialog class
-rw-r--r-- | web/app/view/BaseDialog.js | 23 | ||||
-rw-r--r-- | web/app/view/BaseEditDialog.js | 27 | ||||
-rw-r--r-- | web/app/view/BaseEditDialogController.js (renamed from web/app/view/admin/ServerDialogController.js) | 5 | ||||
-rw-r--r-- | web/app/view/ServerDialog.js (renamed from web/app/view/admin/ServerDialog.js) | 25 | ||||
-rw-r--r-- | web/app/view/device/DeviceController.js | 4 |
5 files changed, 60 insertions, 24 deletions
diff --git a/web/app/view/BaseDialog.js b/web/app/view/BaseDialog.js new file mode 100644 index 000000000..d875e14c9 --- /dev/null +++ b/web/app/view/BaseDialog.js @@ -0,0 +1,23 @@ +/* + * Copyright 2015 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.BaseDialog', { + extend: 'Ext.window.Window', + + bodyPadding: styles.panelPadding, + resizable: false, + modal: true +}); diff --git a/web/app/view/BaseEditDialog.js b/web/app/view/BaseEditDialog.js new file mode 100644 index 000000000..df8bfda93 --- /dev/null +++ b/web/app/view/BaseEditDialog.js @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.BaseEditDialog', { + extend: 'Traccar.view.BaseDialog', + + buttons: [{ + text: strings.sharedSave, + handler: 'onSaveClick' + }, { + text: strings.sharedCancel, + handler: 'onCancelClick' + }] +}); diff --git a/web/app/view/admin/ServerDialogController.js b/web/app/view/BaseEditDialogController.js index ed1ec20f8..ca090f714 100644 --- a/web/app/view/admin/ServerDialogController.js +++ b/web/app/view/BaseEditDialogController.js @@ -14,9 +14,9 @@ * limitations under the License. */ -Ext.define('Traccar.view.admin.ServerDialogController', { +Ext.define('Traccar.view.BaseEditDialogController', { extend: 'Ext.app.ViewController', - alias: 'controller.serverDialog', + alias: 'controller.baseEditDialog', onSaveClick: function(button) { var dialog = button.up('window').down('form'); @@ -28,5 +28,4 @@ Ext.define('Traccar.view.admin.ServerDialogController', { onCancelClick: function(button) { button.up('window').close(); } - }); diff --git a/web/app/view/admin/ServerDialog.js b/web/app/view/ServerDialog.js index 080e2fcc4..1339786ab 100644 --- a/web/app/view/admin/ServerDialog.js +++ b/web/app/view/ServerDialog.js @@ -14,20 +14,16 @@ * limitations under the License. */ -Ext.define('Traccar.view.admin.ServerDialog', { - extend: 'Ext.window.Window', +Ext.define('Traccar.view.ServerDialog', { + extend: 'Traccar.view.BaseEditDialog', requires: [ - 'Traccar.view.admin.ServerDialogController' + 'Traccar.view.BaseEditDialogController' ], - controller: 'serverDialog', - - bodyPadding: styles.panelPadding, + controller: 'baseEditDialog', title: strings.serverTitle, - resizable: false, - modal: true, - + items: { xtype: 'form', items: [{ @@ -77,14 +73,5 @@ Ext.define('Traccar.view.admin.ServerDialog', { name: 'zoom', fieldLabel: strings.serverZoom }] - }, - - buttons: [{ - text: strings.sharedSave, - handler: 'onSaveClick' - }, { - text: strings.sharedCancel, - handler: 'onCancelClick' - }] - + } }); diff --git a/web/app/view/device/DeviceController.js b/web/app/view/device/DeviceController.js index 3cfe3888d..d7cade414 100644 --- a/web/app/view/device/DeviceController.js +++ b/web/app/view/device/DeviceController.js @@ -22,7 +22,7 @@ Ext.define('Traccar.view.device.DeviceController', { 'Traccar.view.device.DeviceDialog', 'Traccar.view.command.CommandDialog', 'Traccar.view.user.UserDialog', - 'Traccar.view.admin.ServerDialog', + 'Traccar.view.ServerDialog', 'Traccar.view.user.User', 'Traccar.view.login.LoginController' ], @@ -112,7 +112,7 @@ Ext.define('Traccar.view.device.DeviceController', { }, onServerClick: function() { - var dialog = Ext.create('Traccar.view.admin.ServerDialog'); + var dialog = Ext.create('Traccar.view.ServerDialog'); dialog.down('form').loadRecord(Traccar.app.getServer()); dialog.show(); }, |