diff options
author | Abyss777 <abyss@fox5.ru> | 2017-01-30 14:08:04 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-01-30 14:08:04 +0500 |
commit | e774dedf3497f640af5a686723a0f5cf0ea42b93 (patch) | |
tree | 331507d9f02a1e25322ac9aa3af490b4b413de62 /web/app/view/AttributeAliasesController.js | |
parent | d1dd9f84e819d70154861ac2487f902da12885ed (diff) | |
download | trackermap-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/AttributeAliasesController.js')
-rw-r--r-- | web/app/view/AttributeAliasesController.js | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/web/app/view/AttributeAliasesController.js b/web/app/view/AttributeAliasesController.js index 1cbb735f..f5348301 100644 --- a/web/app/view/AttributeAliasesController.js +++ b/web/app/view/AttributeAliasesController.js @@ -17,7 +17,7 @@ */ Ext.define('Traccar.view.AttributeAliasesController', { - extend: 'Ext.app.ViewController', + extend: 'Traccar.view.EditToolbarController', alias: 'controller.attributeAliases', requires: [ @@ -25,6 +25,10 @@ Ext.define('Traccar.view.AttributeAliasesController', { 'Traccar.model.AttributeAlias' ], + objectModel: 'Traccar.model.AttributeAlias', + objectDialog: 'Traccar.view.AttributeAliasDialog', + removeTitle: Strings.sharedAttributeAlias, + init: function () { var manager = Traccar.app.getUser().get('admin') || Traccar.app.getUser().get('userLimit') > 0; this.lookupReference('deviceField').setStore(manager ? 'AllDevices' : 'Devices'); @@ -49,36 +53,6 @@ Ext.define('Traccar.view.AttributeAliasesController', { dialog.show(); }, - onEditClick: function () { - var attributeAlias, dialog; - attributeAlias = this.getView().getSelectionModel().getSelection()[0]; - attributeAlias.store = Ext.getStore('AttributeAliases'); - dialog = Ext.create('Traccar.view.AttributeAliasDialog'); - dialog.down('form').loadRecord(attributeAlias); - dialog.show(); - }, - - onRemoveClick: function () { - var attributeAlias = this.getView().getSelectionModel().getSelection()[0]; - Ext.Msg.show({ - title: Strings.sharedAttributeAlias, - message: Strings.sharedRemoveConfirm, - buttons: Ext.Msg.YESNO, - buttonText: { - yes: Strings.sharedRemove, - no: Strings.sharedCancel - }, - scope: this, - fn: function (btn) { - var store = Ext.getStore('AttributeAliases'); - if (btn === 'yes') { - store.remove(attributeAlias); - store.sync(); - } - } - }); - }, - onSelectionChange: function (selected) { var disabled = !this.lookupReference('deviceField').getValue(); this.lookupReference('toolbarAddButton').setDisabled(disabled); |