diff options
Diffstat (limited to 'web/app/view/UserDialogController.js')
-rw-r--r-- | web/app/view/UserDialogController.js | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js index 40c88a8b4..a5d045f5b 100644 --- a/web/app/view/UserDialogController.js +++ b/web/app/view/UserDialogController.js @@ -13,40 +13,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -(function () { - 'use strict'; - Ext.define('Traccar.view.UserDialogController', { - extend: 'Ext.app.ViewController', - alias: 'controller.userDialog', +Ext.define('Traccar.view.UserDialogController', { + extend: 'Ext.app.ViewController', + alias: 'controller.userDialog', - init: function () { - if (Traccar.app.getUser().get('admin')) { - this.lookupReference('adminField').setDisabled(false); - } - }, + init: function () { + if (Traccar.app.getUser().get('admin')) { + this.lookupReference('adminField').setDisabled(false); + } + }, - onSaveClick: function (button) { - var dialog, record, store; - dialog = button.up('window').down('form'); - dialog.updateRecord(); - record = dialog.getRecord(); - if (record === Traccar.app.getUser()) { - record.save(); - } else { - 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()); - } - }); + onSaveClick: function (button) { + var dialog, record, store; + dialog = button.up('window').down('form'); + dialog.updateRecord(); + record = dialog.getRecord(); + if (record === Traccar.app.getUser()) { + record.save(); + } else { + store = Ext.getStore('Users'); + if (record.phantom) { + store.add(record); } - button.up('window').close(); + store.sync({ + failure: function (batch) { + store.rejectChanges(); // TODO + Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse()); + } + }); } - }); - -})(); + button.up('window').close(); + } +}); |