aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/AttributeAliasesController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/AttributeAliasesController.js')
-rw-r--r--web/app/view/AttributeAliasesController.js36
1 files changed, 5 insertions, 31 deletions
diff --git a/web/app/view/AttributeAliasesController.js b/web/app/view/AttributeAliasesController.js
index 1cbb735f..f5348301 100644
--- a/web/app/view/AttributeAliasesController.js
+++ b/web/app/view/AttributeAliasesController.js
@@ -17,7 +17,7 @@
*/
Ext.define('Traccar.view.AttributeAliasesController', {
- extend: 'Ext.app.ViewController',
+ extend: 'Traccar.view.EditToolbarController',
alias: 'controller.attributeAliases',
requires: [
@@ -25,6 +25,10 @@ Ext.define('Traccar.view.AttributeAliasesController', {
'Traccar.model.AttributeAlias'
],
+ objectModel: 'Traccar.model.AttributeAlias',
+ objectDialog: 'Traccar.view.AttributeAliasDialog',
+ removeTitle: Strings.sharedAttributeAlias,
+
init: function () {
var manager = Traccar.app.getUser().get('admin') || Traccar.app.getUser().get('userLimit') > 0;
this.lookupReference('deviceField').setStore(manager ? 'AllDevices' : 'Devices');
@@ -49,36 +53,6 @@ Ext.define('Traccar.view.AttributeAliasesController', {
dialog.show();
},
- onEditClick: function () {
- var attributeAlias, dialog;
- attributeAlias = this.getView().getSelectionModel().getSelection()[0];
- attributeAlias.store = Ext.getStore('AttributeAliases');
- dialog = Ext.create('Traccar.view.AttributeAliasDialog');
- dialog.down('form').loadRecord(attributeAlias);
- dialog.show();
- },
-
- onRemoveClick: function () {
- var attributeAlias = this.getView().getSelectionModel().getSelection()[0];
- Ext.Msg.show({
- title: Strings.sharedAttributeAlias,
- message: Strings.sharedRemoveConfirm,
- buttons: Ext.Msg.YESNO,
- buttonText: {
- yes: Strings.sharedRemove,
- no: Strings.sharedCancel
- },
- scope: this,
- fn: function (btn) {
- var store = Ext.getStore('AttributeAliases');
- if (btn === 'yes') {
- store.remove(attributeAlias);
- store.sync();
- }
- }
- });
- },
-
onSelectionChange: function (selected) {
var disabled = !this.lookupReference('deviceField').getValue();
this.lookupReference('toolbarAddButton').setDisabled(disabled);