aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-09 00:06:07 +1200
committerGitHub <noreply@github.com>2016-07-09 00:06:07 +1200
commit88b48828e46cdb444c4b77f474e0e8c8f37c23ca (patch)
tree49cd339580e98106a089281e48ff2feb04019443
parentc78b3a3478bbedd84ff2fac13a2577a6e1793ec3 (diff)
parent77bdf87d34587d0c6a156816f71fc0874bc7f3dc (diff)
downloadtraccar-server-88b48828e46cdb444c4b77f474e0e8c8f37c23ca.tar.gz
traccar-server-88b48828e46cdb444c4b77f474e0e8c8f37c23ca.tar.bz2
traccar-server-88b48828e46cdb444c4b77f474e0e8c8f37c23ca.zip
Merge pull request #2091 from Abyss777/master
Pass whole record to attribute editor
-rw-r--r--web/app/view/AttributesController.js15
-rw-r--r--web/app/view/UserDialogController.js2
2 files changed, 10 insertions, 7 deletions
diff --git a/web/app/view/AttributesController.js b/web/app/view/AttributesController.js
index 90dc334b1..663b6eae3 100644
--- a/web/app/view/AttributesController.js
+++ b/web/app/view/AttributesController.js
@@ -27,27 +27,30 @@ Ext.define('Traccar.view.AttributesController', {
var store, propertyName, i = 0;
store = Ext.create('Traccar.store.Attributes');
store.setProxy(Ext.create('Ext.data.proxy.Memory'));
- for (propertyName in this.getView().attributes) {
+ for (propertyName in this.getView().record.get('attributes')) {
store.add(Ext.create('Traccar.model.Attribute', {
priority: i++,
name: propertyName,
- value:this.getView().attributes[propertyName]
+ value:this.getView().record.get('attributes')[propertyName]
}));
}
store.addListener('add', function (store , records , index , eOpts) {
for (var i = 0; i < records.length; i++) {
- this.getView().attributes[records[i].get('name')] = records[i].get('value');
+ this.getView().record.get('attributes')[records[i].get('name')] = records[i].get('value');
+ this.getView().record.dirty = true;
}
}, this);
store.addListener('update', function (store, record, operation , modifiedFieldNames , details , eOpts) {
if (operation === Ext.data.Model.EDIT) {
- this.getView().attributes[record.get('name')] = record.get('value');
+ this.getView().record.get('attributes')[record.get('name')] = record.get('value');
+ this.getView().record.dirty = true;
}
}, this);
store.addListener('remove', function (store , records , index , isMove , eOpts) {
- delete this.getView().attributes[records[index].get('name')];
+ delete this.getView().record.get('attributes')[records[index].get('name')];
+ this.getView().record.dirty = true;
}, this);
-
+
this.getView().setStore(store);
},
diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js
index db495b8ff..49dfd9d70 100644
--- a/web/app/view/UserDialogController.js
+++ b/web/app/view/UserDialogController.js
@@ -59,7 +59,7 @@ Ext.define('Traccar.view.UserDialogController', {
modal: false,
items: {
xtype: 'attributesView',
- attributes: record.get('attributes')
+ record: record
}
}).show();
}