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/UsersController.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/UsersController.js')
-rw-r--r-- | web/app/view/UsersController.js | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/web/app/view/UsersController.js b/web/app/view/UsersController.js index 68e49f83..2744be74 100644 --- a/web/app/view/UsersController.js +++ b/web/app/view/UsersController.js @@ -17,7 +17,7 @@ */ Ext.define('Traccar.view.UsersController', { - extend: 'Ext.app.ViewController', + extend: 'Traccar.view.EditToolbarController', alias: 'controller.users', requires: [ @@ -32,6 +32,10 @@ Ext.define('Traccar.view.UsersController', { 'Traccar.model.User' ], + objectModel: 'Traccar.model.User', + objectDialog: 'Traccar.view.UserDialog', + removeTitle: Strings.settingsUser, + init: function () { Ext.getStore('Users').load(); this.lookupReference('userUsersButton').setHidden(!Traccar.app.getUser().get('admin')); @@ -51,34 +55,6 @@ Ext.define('Traccar.view.UsersController', { dialog.show(); }, - onEditClick: function () { - var user, dialog; - user = this.getView().getSelectionModel().getSelection()[0]; - dialog = Ext.create('Traccar.view.UserDialog'); - dialog.down('form').loadRecord(user); - dialog.show(); - }, - - onRemoveClick: function () { - var user = this.getView().getSelectionModel().getSelection()[0]; - Ext.Msg.show({ - title: Strings.settingsUser, - message: Strings.sharedRemoveConfirm, - buttons: Ext.Msg.YESNO, - buttonText: { - yes: Strings.sharedRemove, - no: Strings.sharedCancel - }, - fn: function (btn) { - var store = Ext.getStore('Users'); - if (btn === 'yes') { - store.remove(user); - store.sync(); - } - } - }); - }, - onDevicesClick: function () { var user = this.getView().getSelectionModel().getSelection()[0]; Ext.create('Traccar.view.BaseWindow', { @@ -172,13 +148,12 @@ Ext.define('Traccar.view.UsersController', { onSelectionChange: function (selection, selected) { var disabled = selected.length === 0; - this.lookupReference('toolbarEditButton').setDisabled(disabled); - this.lookupReference('toolbarRemoveButton').setDisabled(disabled); this.lookupReference('userDevicesButton').setDisabled(disabled); this.lookupReference('userGroupsButton').setDisabled(disabled); this.lookupReference('userGeofencesButton').setDisabled(disabled); this.lookupReference('userNotificationsButton').setDisabled(disabled); this.lookupReference('userCalendarsButton').setDisabled(disabled); this.lookupReference('userUsersButton').setDisabled(disabled || selected[0].get('userLimit') === 0); + this.callParent(arguments); } }); |