aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/GroupsController.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/GroupsController.js
parentd1dd9f84e819d70154861ac2487f902da12885ed (diff)
downloadetbsa-traccar-web-e774dedf3497f640af5a686723a0f5cf0ea42b93.tar.gz
etbsa-traccar-web-e774dedf3497f640af5a686723a0f5cf0ea42b93.tar.bz2
etbsa-traccar-web-e774dedf3497f640af5a686723a0f5cf0ea42b93.zip
Implement base controller for windows with EditToolbar
Diffstat (limited to 'web/app/view/GroupsController.js')
-rw-r--r--web/app/view/GroupsController.js46
1 files changed, 6 insertions, 40 deletions
diff --git a/web/app/view/GroupsController.js b/web/app/view/GroupsController.js
index 26b34da..98568db 100644
--- a/web/app/view/GroupsController.js
+++ b/web/app/view/GroupsController.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.GroupsController', {
- extend: 'Ext.app.ViewController',
+ extend: 'Traccar.view.EditToolbarController',
alias: 'controller.groups',
requires: [
@@ -26,42 +26,9 @@ Ext.define('Traccar.view.GroupsController', {
'Traccar.model.Group'
],
- onAddClick: function () {
- var group, dialog;
- group = Ext.create('Traccar.model.Group');
- group.store = this.getView().getStore();
- dialog = Ext.create('Traccar.view.GroupDialog');
- dialog.down('form').loadRecord(group);
- dialog.show();
- },
-
- onEditClick: function () {
- var group, dialog;
- group = this.getView().getSelectionModel().getSelection()[0];
- dialog = Ext.create('Traccar.view.GroupDialog');
- dialog.down('form').loadRecord(group);
- dialog.show();
- },
-
- onRemoveClick: function () {
- var group = this.getView().getSelectionModel().getSelection()[0];
- Ext.Msg.show({
- title: Strings.groupDialog,
- message: Strings.sharedRemoveConfirm,
- buttons: Ext.Msg.YESNO,
- buttonText: {
- yes: Strings.sharedRemove,
- no: Strings.sharedCancel
- },
- fn: function (btn) {
- var store = Ext.getStore('Groups');
- if (btn === 'yes') {
- store.remove(group);
- store.sync();
- }
- }
- });
- },
+ objectModel: 'Traccar.model.Group',
+ objectDialog: 'Traccar.view.GroupDialog',
+ removeTitle: Strings.groupDialog,
onGeofencesClick: function () {
var admin, group;
@@ -82,8 +49,7 @@ Ext.define('Traccar.view.GroupsController', {
onSelectionChange: function (selected) {
var disabled = selected.length > 0;
- this.lookupReference('toolbarEditButton').setDisabled(disabled);
- this.lookupReference('toolbarRemoveButton').setDisabled(disabled);
this.lookupReference('toolbarGeofencesButton').setDisabled(disabled);
+ this.callParent(arguments);
}
});