From dc76207257da485eeb4887202335c24e46d90263 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 20 May 2015 22:37:34 +1200 Subject: Add report controller events --- web/app/view/map/Map.js | 6 +++++ web/app/view/map/MapController.js | 40 +++++++++++++++++++++++++++++++++ web/app/view/report/ReportController.js | 4 ++++ 3 files changed, 50 insertions(+) create mode 100644 web/app/view/map/MapController.js (limited to 'web') diff --git a/web/app/view/map/Map.js b/web/app/view/map/Map.js index 38ec00447..a43df40e1 100644 --- a/web/app/view/map/Map.js +++ b/web/app/view/map/Map.js @@ -18,6 +18,12 @@ Ext.define('Traccar.view.map.Map', { extend: 'Ext.form.Panel', xtype: 'map-view', + requires: [ + 'Traccar.view.map.MapController' + ], + + controller: 'map', + title: strings.map_title, layout: 'fit', diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js new file mode 100644 index 000000000..d02d454d6 --- /dev/null +++ b/web/app/view/map/MapController.js @@ -0,0 +1,40 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Ext.define('Traccar.view.map.MapController', { + extend: 'Ext.app.ViewController', + alias: 'controller.map', + + config: { + listen: { + controller: { + '*': { + reportShow: 'reportShow', + reportClear: 'reportClear' + } + } + } + }, + + reportShow: function() { + console.log('reportShow'); + }, + + reportClear: function() { + console.log('reportClear'); + } + +}); diff --git a/web/app/view/report/ReportController.js b/web/app/view/report/ReportController.js index 81da6fb83..df194c7f1 100644 --- a/web/app/view/report/ReportController.js +++ b/web/app/view/report/ReportController.js @@ -43,10 +43,14 @@ Ext.define('Traccar.view.report.ReportController', { to: to } }); + + this.fireEvent("reportShow"); }, onClearClick: function() { Ext.getStore('Positions').removeAll(); + + this.fireEvent("reportClear"); } }); -- cgit v1.2.3