aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/GeofencesController.js
diff options
context:
space:
mode:
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
});