aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/user/UserDialogController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-06 23:18:49 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-06 23:18:49 +1200
commiteaa0044002aeaff0b5df11f8463a068a6ff2284d (patch)
treefb9cec4ad52ac09f0b75061a41947dbc89b2cf81 /web/app/view/user/UserDialogController.js
parent40107a7886412c4582ea9a9ee946f454e28a1178 (diff)
downloadtrackermap-server-eaa0044002aeaff0b5df11f8463a068a6ff2284d.tar.gz
trackermap-server-eaa0044002aeaff0b5df11f8463a068a6ff2284d.tar.bz2
trackermap-server-eaa0044002aeaff0b5df11f8463a068a6ff2284d.zip
Add user management window
Diffstat (limited to 'web/app/view/user/UserDialogController.js')
-rw-r--r--web/app/view/user/UserDialogController.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/web/app/view/user/UserDialogController.js b/web/app/view/user/UserDialogController.js
index 4c6b6c42f..1ec14c5e8 100644
--- a/web/app/view/user/UserDialogController.js
+++ b/web/app/view/user/UserDialogController.js
@@ -21,7 +21,21 @@ Ext.define('Traccar.view.user.UserDialogController', {
onSaveClick: function(button) {
var dialog = button.up('window').down('form');
dialog.updateRecord();
- dialog.getRecord().save();
+ var record = dialog.getRecord();
+ if (record === Traccar.getApplication().getUser()) {
+ record.save();
+ } else {
+ var store = Ext.getStore('Users');
+ if (record.phantom) {
+ store.add(record);
+ }
+ store.sync({
+ failure: function(batch) {
+ store.rejectChanges(); // TODO
+ Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse());
+ }
+ });
+ }
button.up('window').close();
},