aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/Map.js38
-rw-r--r--web/app/view/MapController.js18
-rw-r--r--web/app/view/MapPickerDialogController.js12
-rw-r--r--web/app/view/ServerDialog.js6
-rw-r--r--web/app/view/UserDialog.js6
5 files changed, 24 insertions, 56 deletions
diff --git a/web/app/view/Map.js b/web/app/view/Map.js
index ebc6bbb0..f9bb6250 100644
--- a/web/app/view/Map.js
+++ b/web/app/view/Map.js
@@ -29,6 +29,15 @@ Ext.define('Traccar.view.Map', {
title: Strings.mapTitle,
tbar: {
componentCls: 'toolbar-header-style',
+ defaults: {
+ xtype: 'button',
+ tooltipType: 'title',
+ stateEvents: ['toggle'],
+ enableToggle: true,
+ stateful: {
+ pressed: true
+ }
+ },
items: [{
xtype: 'tbtext',
html: Strings.mapTitle,
@@ -36,41 +45,37 @@ Ext.define('Traccar.view.Map', {
}, {
xtype: 'tbfill'
}, {
- xtype: 'button',
- tooltipType: 'title',
handler: 'showReports',
reference: 'showReportsButton',
glyph: 'xf0f6@FontAwesome',
+ stateful: false,
+ enableToggle: false,
tooltip: Strings.reportTitle
}, {
- xtype: 'button',
- tooltipType: 'title',
handler: 'updateGeofences',
reference: 'showGeofencesButton',
glyph: 'xf21d@FontAwesome',
- enableToggle: true,
+ pressed: true,
+ stateId: 'show-geofences-button',
tooltip: Strings.sharedGeofences
}, {
- xtype: 'button',
- tooltipType: 'title',
handler: 'showLiveRoutes',
reference: 'showLiveRoutes',
glyph: 'xf1b0@FontAwesome',
- enableToggle: true,
+ stateId: 'show-live-routes-button',
tooltip: Strings.mapLiveRoutes
}, {
reference: 'deviceFollowButton',
glyph: 'xf05b@FontAwesome',
tooltip: Strings.deviceFollow,
- tooltipType: 'title',
- enableToggle: true,
+ stateId: 'device-follow-button',
toggleHandler: 'onFollowClick'
}, {
id: 'muteButton',
glyph: 'xf1f7@FontAwesome',
tooltip: Strings.sharedMute,
- tooltipType: 'title',
- enableToggle: true,
+ pressed: true,
+ stateId: 'mute-button',
listeners: {
toggle: function (button, pressed) {
if (pressed) {
@@ -78,11 +83,14 @@ Ext.define('Traccar.view.Map', {
} else {
button.setGlyph('xf0a2@FontAwesome');
}
- },
- scope: this
+ }
+ },
+ applyState: function (state) {
+ this.toggle(state.pressed);
}
}, {
- xtype: 'settingsMenu'
+ xtype: 'settingsMenu',
+ enableToggle: false
}]
},
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js
index 57727f20..04e8c448 100644
--- a/web/app/view/MapController.js
+++ b/web/app/view/MapController.js
@@ -28,7 +28,6 @@ Ext.define('Traccar.view.MapController', {
controller: {
'*': {
mapstaterequest: 'getMapState',
- togglestaterequest: 'getToggleState',
zoomtoalldevices: 'zoomToAllDevices'
}
},
@@ -46,14 +45,6 @@ Ext.define('Traccar.view.MapController', {
init: function () {
this.callParent();
this.lookupReference('showReportsButton').setVisible(Traccar.app.isMobile());
- this.lookupReference('deviceFollowButton').setPressed(
- Traccar.app.getAttributePreference('web.followToggle', 'false') === 'true');
- this.lookupReference('showGeofencesButton').setPressed(
- Traccar.app.getAttributePreference('web.geofenceToggle', 'true') === 'true');
- this.lookupReference('showLiveRoutes').setPressed(
- Traccar.app.getAttributePreference('web.liveRouteToggle', 'false') === 'true');
- Ext.getCmp('muteButton').setPressed(
- Traccar.app.getAttributePreference('web.muteToggle', 'true') === 'true');
},
showReports: function () {
@@ -78,15 +69,6 @@ Ext.define('Traccar.view.MapController', {
this.fireEvent('mapstate', center[1], center[0], zoom);
},
- getToggleState: function () {
- var state = {};
- state['web.followToggle'] = this.lookupReference('deviceFollowButton').pressed.toString();
- state['web.geofenceToggle'] = this.lookupReference('showGeofencesButton').pressed.toString();
- state['web.liveRouteToggle'] = this.lookupReference('showLiveRoutes').pressed.toString();
- state['web.muteToggle'] = Ext.getCmp('muteButton').pressed.toString();
- this.fireEvent('togglestate', state);
- },
-
updateGeofences: function () {
this.getView().getGeofencesSource().clear();
if (this.lookupReference('showGeofencesButton').pressed) {
diff --git a/web/app/view/MapPickerDialogController.js b/web/app/view/MapPickerDialogController.js
index 6a3b1a51..1dc48ea0 100644
--- a/web/app/view/MapPickerDialogController.js
+++ b/web/app/view/MapPickerDialogController.js
@@ -24,8 +24,7 @@ Ext.define('Traccar.view.MapPickerDialogController', {
listen: {
controller: {
'*': {
- mapstate: 'setMapState',
- togglestate: 'setToggleState'
+ mapstate: 'setMapState'
}
}
}
@@ -35,18 +34,9 @@ Ext.define('Traccar.view.MapPickerDialogController', {
this.fireEvent('mapstaterequest');
},
- getToggleState: function (button) {
- this.fireEvent('togglestaterequest');
- },
-
setMapState: function (lat, lon, zoom) {
this.lookupReference('latitude').setValue(lat);
this.lookupReference('longitude').setValue(lon);
this.lookupReference('zoom').setValue(zoom);
- },
-
- setToggleState: function (state) {
- var record = this.getView().down('form').getRecord();
- record.set('attributes', Ext.merge(record.get('attributes'), state));
}
});
diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js
index bba5e729..13ddcb31 100644
--- a/web/app/view/ServerDialog.js
+++ b/web/app/view/ServerDialog.js
@@ -150,12 +150,6 @@ Ext.define('Traccar.view.ServerDialog', {
tooltip: Strings.sharedGetMapState,
tooltipType: 'title'
}, {
- glyph: 'xf205@FontAwesome',
- minWidth: 0,
- handler: 'getToggleState',
- tooltip: Strings.sharedGetToggleState,
- tooltipType: 'title'
- }, {
xtype: 'tbfill'
}, {
glyph: 'xf00c@FontAwesome',
diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js
index 874f9f00..8df7f2ff 100644
--- a/web/app/view/UserDialog.js
+++ b/web/app/view/UserDialog.js
@@ -202,12 +202,6 @@ Ext.define('Traccar.view.UserDialog', {
tooltip: Strings.sharedGetMapState,
tooltipType: 'title'
}, {
- glyph: 'xf205@FontAwesome',
- minWidth: 0,
- handler: 'getToggleState',
- tooltip: Strings.sharedGetToggleState,
- tooltipType: 'title'
- }, {
glyph: 'xf003@FontAwesome',
minWidth: 0,
handler: 'testNotification',