aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-04-17 15:52:22 +0500
committerAbyss777 <abyss@fox5.ru>2017-04-17 15:52:22 +0500
commit22b764a71a450e4f4e8ad1a0439cf708e6bcd952 (patch)
tree0a8a9a9ff650e92fbf86e225afa7ae8ba35601a7 /web/app/view
parentfbe7831f7765d62853641750b85861b19a2a8715 (diff)
downloadetbsa-traccar-web-22b764a71a450e4f4e8ad1a0439cf708e6bcd952.tar.gz
etbsa-traccar-web-22b764a71a450e4f4e8ad1a0439cf708e6bcd952.tar.bz2
etbsa-traccar-web-22b764a71a450e4f4e8ad1a0439cf708e6bcd952.zip
Translate known attributes
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/edit/Attributes.js9
-rw-r--r--web/app/view/edit/AttributesController.js42
2 files changed, 27 insertions, 24 deletions
diff --git a/web/app/view/edit/Attributes.js b/web/app/view/edit/Attributes.js
index 93e5a3a..8008319 100644
--- a/web/app/view/edit/Attributes.js
+++ b/web/app/view/edit/Attributes.js
@@ -41,7 +41,14 @@ Ext.define('Traccar.view.edit.Attributes', {
},
items: [{
text: Strings.sharedName,
- dataIndex: 'name'
+ dataIndex: 'name',
+ renderer: function (value, metaData) {
+ var result;
+ if (this.attributesStore) {
+ result = Ext.getStore(this.attributesStore).getById(value);
+ }
+ return result && result.get('name') ? result.get('name') : value;
+ }
}, {
text: Strings.stateValue,
dataIndex: 'value'
diff --git a/web/app/view/edit/AttributesController.js b/web/app/view/edit/AttributesController.js
index cf4f64c..235f2c5 100644
--- a/web/app/view/edit/AttributesController.js
+++ b/web/app/view/edit/AttributesController.js
@@ -69,6 +69,17 @@ Ext.define('Traccar.view.edit.AttributesController', {
}, this);
this.getView().setStore(store);
+ if (this.getView().record instanceof Traccar.model.Device) {
+ this.getView().attributesStore = 'DeviceAttributes';
+ } else if (this.getView().record instanceof Traccar.model.Geofence) {
+ this.getView().attributesStore = 'GeofenceAttributes';
+ } else if (this.getView().record instanceof Traccar.model.Group) {
+ this.getView().attributesStore = 'GroupAttributes';
+ } else if (this.getView().record instanceof Traccar.model.Server) {
+ this.getView().attributesStore = 'ServerAttributes';
+ } else if (this.getView().record instanceof Traccar.model.User) {
+ this.getView().attributesStore = 'UserAttributes';
+ }
},
comboConfig: {
@@ -76,36 +87,21 @@ Ext.define('Traccar.view.edit.AttributesController', {
reference: 'nameComboField',
name: 'name',
fieldLabel: Strings.sharedName,
- displayField: 'key',
+ displayField: 'name',
+ valueField: 'key',
allowBlank: false,
listeners: {
change: 'onNameChange'
}
},
- replaceNameField: function (dialog, config) {
- var nameTextField = dialog.lookupReference('nameTextField');
- dialog.down('form').insert(0, config);
- dialog.down('form').remove(nameTextField);
- },
-
initDialog: function (record) {
- var dialog = Ext.create('Traccar.view.dialog.Attribute');
- if (this.getView().record instanceof Traccar.model.Device) {
- this.comboConfig.store = 'DeviceAttributes';
- this.replaceNameField(dialog, this.comboConfig);
- } else if (this.getView().record instanceof Traccar.model.Geofence) {
- this.comboConfig.store = 'GeofenceAttributes';
- this.replaceNameField(dialog, this.comboConfig);
- } else if (this.getView().record instanceof Traccar.model.Group) {
- this.comboConfig.store = 'GroupAttributes';
- this.replaceNameField(dialog, this.comboConfig);
- } else if (this.getView().record instanceof Traccar.model.Server) {
- this.comboConfig.store = 'ServerAttributes';
- this.replaceNameField(dialog, this.comboConfig);
- } else if (this.getView().record instanceof Traccar.model.User) {
- this.comboConfig.store = 'UserAttributes';
- this.replaceNameField(dialog, this.comboConfig);
+ var nameTextField, dialog = Ext.create('Traccar.view.dialog.Attribute');
+ if (this.getView().attributesStore) {
+ this.comboConfig.store = this.getView().attributesStore;
+ nameTextField = dialog.lookupReference('nameTextField');
+ dialog.down('form').insert(0, this.comboConfig);
+ dialog.down('form').remove(nameTextField);
}
dialog.down('form').loadRecord(record);
dialog.show();