aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/AttributesController.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-01-30 14:08:04 +0500
committerAbyss777 <abyss@fox5.ru>2017-01-30 14:08:04 +0500
commite774dedf3497f640af5a686723a0f5cf0ea42b93 (patch)
tree331507d9f02a1e25322ac9aa3af490b4b413de62 /web/app/view/AttributesController.js
parentd1dd9f84e819d70154861ac2487f902da12885ed (diff)
downloadtrackermap-web-e774dedf3497f640af5a686723a0f5cf0ea42b93.tar.gz
trackermap-web-e774dedf3497f640af5a686723a0f5cf0ea42b93.tar.bz2
trackermap-web-e774dedf3497f640af5a686723a0f5cf0ea42b93.zip
Implement base controller for windows with EditToolbar
Diffstat (limited to 'web/app/view/AttributesController.js')
-rw-r--r--web/app/view/AttributesController.js52
1 files changed, 6 insertions, 46 deletions
diff --git a/web/app/view/AttributesController.js b/web/app/view/AttributesController.js
index 918938f1..1c5f5b4b 100644
--- a/web/app/view/AttributesController.js
+++ b/web/app/view/AttributesController.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
*/
Ext.define('Traccar.view.AttributesController', {
- extend: 'Ext.app.ViewController',
+ extend: 'Traccar.view.EditToolbarController',
alias: 'controller.attributes',
requires: [
@@ -25,6 +25,10 @@ Ext.define('Traccar.view.AttributesController', {
'Traccar.model.Attribute'
],
+ objectModel: 'Traccar.model.Attribute',
+ objectDialog: 'Traccar.view.AttributeDialog',
+ removeTitle: Strings.stateName,
+
init: function () {
var store, propertyName, i = 0, attributes;
store = Ext.create('Traccar.store.Attributes');
@@ -67,49 +71,5 @@ Ext.define('Traccar.view.AttributesController', {
}, this);
this.getView().setStore(store);
- },
-
- onAddClick: function () {
- var attribute, dialog;
- attribute = Ext.create('Traccar.model.Attribute');
- attribute.store = this.getView().getStore();
- dialog = Ext.create('Traccar.view.AttributeDialog');
- dialog.down('form').loadRecord(attribute);
- dialog.show();
- },
-
- onEditClick: function () {
- var attribute, dialog;
- attribute = this.getView().getSelectionModel().getSelection()[0];
- dialog = Ext.create('Traccar.view.AttributeDialog');
- dialog.down('form').loadRecord(attribute);
- dialog.show();
- },
-
- onRemoveClick: function () {
- var attribute = this.getView().getSelectionModel().getSelection()[0];
- Ext.Msg.show({
- title: Strings.stateName,
- message: Strings.sharedRemoveConfirm,
- buttons: Ext.Msg.YESNO,
- buttonText: {
- yes: Strings.sharedRemove,
- no: Strings.sharedCancel
- },
- scope: this,
- fn: function (btn) {
- var store = this.getView().getStore();
- if (btn === 'yes') {
- store.remove(attribute);
- store.sync();
- }
- }
- });
- },
-
- onSelectionChange: function (selected) {
- var disabled = selected.length > 0;
- this.lookupReference('toolbarEditButton').setDisabled(disabled);
- this.lookupReference('toolbarRemoveButton').setDisabled(disabled);
}
});