aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/GeofencesController.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/GeofencesController.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/GeofencesController.js')
-rw-r--r--web/app/view/GeofencesController.js49
1 files changed, 5 insertions, 44 deletions
diff --git a/web/app/view/GeofencesController.js b/web/app/view/GeofencesController.js
index 78389066..bf330872 100644
--- a/web/app/view/GeofencesController.js
+++ b/web/app/view/GeofencesController.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.GeofencesController', {
- extend: 'Ext.app.ViewController',
+ extend: 'Traccar.view.EditToolbarController',
alias: 'controller.geofences',
requires: [
@@ -29,46 +29,7 @@ Ext.define('Traccar.view.GeofencesController', {
Ext.getStore('Calendars').load();
},
- onAddClick: function () {
- var geofence, dialog;
- geofence = Ext.create('Traccar.model.Geofence');
- geofence.store = this.getView().getStore();
- dialog = Ext.create('Traccar.view.GeofenceDialog');
- dialog.down('form').loadRecord(geofence);
- dialog.show();
- },
-
- onEditClick: function () {
- var geofence, dialog;
- geofence = this.getView().getSelectionModel().getSelection()[0];
- dialog = Ext.create('Traccar.view.GeofenceDialog');
- dialog.down('form').loadRecord(geofence);
- dialog.show();
- },
-
- onRemoveClick: function () {
- var geofence = this.getView().getSelectionModel().getSelection()[0];
- Ext.Msg.show({
- title: Strings.sharedGeofence,
- message: Strings.sharedRemoveConfirm,
- buttons: Ext.Msg.YESNO,
- buttonText: {
- yes: Strings.sharedRemove,
- no: Strings.sharedCancel
- },
- fn: function (btn) {
- var store = Ext.getStore('Geofences');
- if (btn === 'yes') {
- store.remove(geofence);
- store.sync();
- }
- }
- });
- },
-
- onSelectionChange: function (selected) {
- var disabled = selected.length > 0;
- this.lookupReference('toolbarEditButton').setDisabled(disabled);
- this.lookupReference('toolbarRemoveButton').setDisabled(disabled);
- }
+ objectModel: 'Traccar.model.Geofence',
+ objectDialog: 'Traccar.view.GeofenceDialog',
+ removeTitle: Strings.sharedGeofence
});