aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/UsersController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/UsersController.js')
-rw-r--r--web/app/view/UsersController.js37
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);
}
});