aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/app/view/BaseDialogController.js23
-rw-r--r--web/app/view/BaseEditDialogController.js6
-rw-r--r--web/app/view/CommandDialog.js (renamed from web/app/view/command/CommandDialog.js)13
-rw-r--r--web/app/view/CommandDialogController.js (renamed from web/app/view/command/CommandDialogController.js)13
-rw-r--r--web/app/view/device/DeviceController.js4
5 files changed, 34 insertions, 25 deletions
diff --git a/web/app/view/BaseDialogController.js b/web/app/view/BaseDialogController.js
new file mode 100644
index 000000000..4bf23d94e
--- /dev/null
+++ b/web/app/view/BaseDialogController.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.BaseDialogController', {
+ extend: 'Ext.app.ViewController',
+
+ onCancelClick: function(button) {
+ button.up('window').close();
+ }
+});
diff --git a/web/app/view/BaseEditDialogController.js b/web/app/view/BaseEditDialogController.js
index ca090f714..df4db0e50 100644
--- a/web/app/view/BaseEditDialogController.js
+++ b/web/app/view/BaseEditDialogController.js
@@ -15,7 +15,7 @@
*/
Ext.define('Traccar.view.BaseEditDialogController', {
- extend: 'Ext.app.ViewController',
+ extend: 'Traccar.view.BaseDialogController',
alias: 'controller.baseEditDialog',
onSaveClick: function(button) {
@@ -23,9 +23,5 @@ Ext.define('Traccar.view.BaseEditDialogController', {
dialog.updateRecord();
dialog.getRecord().save();
button.up('window').close();
- },
-
- onCancelClick: function(button) {
- button.up('window').close();
}
});
diff --git a/web/app/view/command/CommandDialog.js b/web/app/view/CommandDialog.js
index 8f567a74a..1cc96b195 100644
--- a/web/app/view/command/CommandDialog.js
+++ b/web/app/view/CommandDialog.js
@@ -14,20 +14,16 @@
* limitations under the License.
*/
-Ext.define('Traccar.view.command.CommandDialog', {
- extend: 'Ext.window.Window',
+Ext.define('Traccar.view.CommandDialog', {
+ extend: 'Traccar.view.BaseDialog',
requires: [
- 'Traccar.view.command.CommandDialogController'
+ 'Traccar.view.CommandDialogController'
],
controller: 'commandDialog',
-
- bodyPadding: styles.panelPadding,
title: strings.commandTitle,
- resizable: false,
- modal: true,
-
+
items: {
xtype: 'form',
items: [{
@@ -68,5 +64,4 @@ Ext.define('Traccar.view.command.CommandDialog', {
text: strings.sharedCancel,
handler: 'onCancelClick'
}]
-
});
diff --git a/web/app/view/command/CommandDialogController.js b/web/app/view/CommandDialogController.js
index 8c13ea1e1..66a10bbb6 100644
--- a/web/app/view/command/CommandDialogController.js
+++ b/web/app/view/CommandDialogController.js
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-Ext.define('Traccar.view.command.CommandDialogController', {
- extend: 'Ext.app.ViewController',
+Ext.define('Traccar.view.CommandDialogController', {
+ extend: 'Traccar.view.BaseDialogController',
alias: 'controller.commandDialog',
onSelect: function(selected) {
@@ -44,19 +44,14 @@ Ext.define('Traccar.view.command.CommandDialogController', {
scope: this,
url: '/api/command/send',
jsonData: record.getData(),
- callback: this.onSendReturn
+ callback: this.onSendResult
});
},
- onSendReturn: function(options, success, response) {
+ onSendResult: function(options, success, response) {
if (Traccar.ErrorManager.check(success, response)) {
Ext.toast(strings.commandSent);
this.closeView();
}
- },
-
- onCancelClick: function(button) {
- button.up('window').close();
}
-
});
diff --git a/web/app/view/device/DeviceController.js b/web/app/view/device/DeviceController.js
index d7cade414..58386596d 100644
--- a/web/app/view/device/DeviceController.js
+++ b/web/app/view/device/DeviceController.js
@@ -20,7 +20,7 @@ Ext.define('Traccar.view.device.DeviceController', {
requires: [
'Traccar.view.device.DeviceDialog',
- 'Traccar.view.command.CommandDialog',
+ 'Traccar.view.CommandDialog',
'Traccar.view.user.UserDialog',
'Traccar.view.ServerDialog',
'Traccar.view.user.User',
@@ -90,7 +90,7 @@ Ext.define('Traccar.view.device.DeviceController', {
device = this.getView().getSelectionModel().getSelection()[0];
command = Ext.create('Traccar.model.Command');
command.set('deviceId', device.get('id'));
- dialog = Ext.create('Traccar.view.command.CommandDialog');
+ dialog = Ext.create('Traccar.view.CommandDialog');
dialog.down('form').loadRecord(command);
dialog.show();
},