From a3641de343252f405df7970c97c72fff3e7405b9 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 2 Dec 2016 15:59:45 +0700 Subject: Use model instead of attributes to store notifications options --- web/app/view/NotificationsController.js | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'web/app/view/NotificationsController.js') diff --git a/web/app/view/NotificationsController.js b/web/app/view/NotificationsController.js index b920c18..4c83b14 100644 --- a/web/app/view/NotificationsController.js +++ b/web/app/view/NotificationsController.js @@ -24,42 +24,19 @@ Ext.define('Traccar.view.NotificationsController', { ], init: function () { - this.userId = this.getView().user.getId(); this.getView().getStore().load({ - scope: this, - callback: function (records, operation, success) { - Ext.create('Traccar.store.Notifications').load({ - params: { - userId: this.userId - }, - scope: this, - callback: function (records, operation, success) { - if (success) { - this.getView().getStore().loadData(records); - } - } - }); + params: { + userId: this.getView().user.getId() } }); }, onCheckChange: function (column, rowIndex, checked, eOpts) { - var record, attributes = {}; - record = this.getView().getStore().getAt(rowIndex); - if (record.get('attributes.web')) { - attributes.web = 'true'; - } - if (record.get('attributes.mail')) { - attributes.mail = 'true'; - } + var record = this.getView().getStore().getAt(rowIndex); Ext.Ajax.request({ scope: this, url: 'api/users/notifications', - jsonData: { - userId: this.userId, - type: record.get('type'), - attributes: attributes - }, + jsonData: record.data, callback: function (options, success, response) { if (!success) { Traccar.app.showError(response); -- cgit v1.2.3