aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/DevicesController.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-01-30 14:08:04 +0500
committerAbyss777 <abyss@fox5.ru>2017-01-30 14:08:04 +0500
commite774dedf3497f640af5a686723a0f5cf0ea42b93 (patch)
tree331507d9f02a1e25322ac9aa3af490b4b413de62 /web/app/view/DevicesController.js
parentd1dd9f84e819d70154861ac2487f902da12885ed (diff)
downloadtrackermap-web-e774dedf3497f640af5a686723a0f5cf0ea42b93.tar.gz
trackermap-web-e774dedf3497f640af5a686723a0f5cf0ea42b93.tar.bz2
trackermap-web-e774dedf3497f640af5a686723a0f5cf0ea42b93.zip
Implement base controller for windows with EditToolbar
Diffstat (limited to 'web/app/view/DevicesController.js')
-rw-r--r--web/app/view/DevicesController.js51
1 files changed, 6 insertions, 45 deletions
diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js
index f7e4bb47..e856731c 100644
--- a/web/app/view/DevicesController.js
+++ b/web/app/view/DevicesController.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
*/
Ext.define('Traccar.view.DevicesController', {
- extend: 'Ext.app.ViewController',
+ extend: 'Traccar.view.EditToolbarController',
alias: 'controller.devices',
requires: [
@@ -47,6 +47,10 @@ Ext.define('Traccar.view.DevicesController', {
}
},
+ objectModel: 'Traccar.model.Device',
+ objectDialog: 'Traccar.view.DeviceDialog',
+ removeTitle: Strings.sharedDevice,
+
init: function () {
var readonly, deviceReadonly;
deviceReadonly = Traccar.app.getUser().get('deviceReadonly');
@@ -57,49 +61,6 @@ Ext.define('Traccar.view.DevicesController', {
this.lookupReference('toolbarGeofencesButton').setVisible(!readonly);
},
- onAddClick: function () {
- var device, dialog;
- device = Ext.create('Traccar.model.Device');
- device.store = Ext.getStore('Devices');
- dialog = Ext.create('Traccar.view.DeviceDialog');
- dialog.down('form').loadRecord(device);
- dialog.show();
- },
-
- onEditClick: function () {
- var device, dialog;
- device = this.getView().getSelectionModel().getSelection()[0];
- dialog = Ext.create('Traccar.view.DeviceDialog');
- dialog.down('form').loadRecord(device);
- dialog.show();
- },
-
- onRemoveClick: function () {
- var device = this.getView().getSelectionModel().getSelection()[0];
- Ext.Msg.show({
- title: Strings.deviceDialog,
- message: Strings.sharedRemoveConfirm,
- buttons: Ext.Msg.YESNO,
- buttonText: {
- yes: Strings.sharedRemove,
- no: Strings.sharedCancel
- },
- fn: function (btn) {
- var store;
- if (btn === 'yes') {
- store = Ext.getStore('Devices');
- store.remove(device);
- store.sync({
- failure: function (batch) {
- store.rejectChanges();
- Traccar.app.showError(batch.exceptions[0].getError().response);
- }
- });
- }
- }
- });
- },
-
onGeofencesClick: function () {
var device = this.getView().getSelectionModel().getSelection()[0];
Ext.create('Traccar.view.BaseWindow', {