diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-01-31 17:06:07 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-31 17:06:07 +1300 |
commit | 962c40e2127f9c9a7687e4ccb7a6d4a33ac203f7 (patch) | |
tree | 20aa53bbe7d9bb08391e97afdaf1210afd2e4077 /web/app/view/AttributeAliasesController.js | |
parent | d1dd9f84e819d70154861ac2487f902da12885ed (diff) | |
parent | da14c04199fe22e6c8bdc02edb2fba7a7ab96a4c (diff) | |
download | trackermap-web-962c40e2127f9c9a7687e4ccb7a6d4a33ac203f7.tar.gz trackermap-web-962c40e2127f9c9a7687e4ccb7a6d4a33ac203f7.tar.bz2 trackermap-web-962c40e2127f9c9a7687e4ccb7a6d4a33ac203f7.zip |
Merge pull request #394 from Abyss777/toolbar_controller
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); |