aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/edit
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-08-22 14:11:55 +1200
committerGitHub <noreply@github.com>2017-08-22 14:11:55 +1200
commit0401e755936df29af9eeb129f8cc99e3b151f05c (patch)
tree1fa898c25d4fb3695c34f1e96507e61b6d3da7b8 /web/app/view/edit
parente0bb9b92d07176677b3043530660af3bc30774d7 (diff)
parent7e2fb28b558f404442bec67a7551e75fc90ff100 (diff)
downloadtrackermap-web-0401e755936df29af9eeb129f8cc99e3b151f05c.tar.gz
trackermap-web-0401e755936df29af9eeb129f8cc99e3b151f05c.tar.bz2
trackermap-web-0401e755936df29af9eeb129f8cc99e3b151f05c.zip
Merge pull request #553 from tsmgeek/optimise-ifs
Optimise ifs and loops
Diffstat (limited to 'web/app/view/edit')
-rw-r--r--web/app/view/edit/AttributesController.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/web/app/view/edit/AttributesController.js b/web/app/view/edit/AttributesController.js
index c12c1968..84ff6adf 100644
--- a/web/app/view/edit/AttributesController.js
+++ b/web/app/view/edit/AttributesController.js
@@ -45,27 +45,31 @@ Ext.define('Traccar.view.edit.AttributesController', {
}
}
store.addListener('add', function (store, records) {
- var i;
+ var i, view;
+ view = this.getView();
for (i = 0; i < records.length; i++) {
- this.getView().record.get('attributes')[records[i].get('name')] = records[i].get('value');
+ view.record.get('attributes')[records[i].get('name')] = records[i].get('value');
}
- this.getView().record.dirty = true;
+ view.record.dirty = true;
}, this);
store.addListener('update', function (store, record, operation) {
+ var view;
+ view = this.getView();
if (operation === Ext.data.Model.EDIT) {
if (record.modified.name !== record.get('name')) {
- delete this.getView().record.get('attributes')[record.modified.name];
+ delete view.record.get('attributes')[record.modified.name];
}
- this.getView().record.get('attributes')[record.get('name')] = record.get('value');
- this.getView().record.dirty = true;
+ view.record.get('attributes')[record.get('name')] = record.get('value');
+ view.record.dirty = true;
}
}, this);
store.addListener('remove', function (store, records) {
- var i;
+ var i, view;
+ view = this.getView();
for (i = 0; i < records.length; i++) {
- delete this.getView().record.get('attributes')[records[i].get('name')];
+ delete view.record.get('attributes')[records[i].get('name')];
}
- this.getView().record.dirty = true;
+ view.record.dirty = true;
}, this);
this.getView().setStore(store);