diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/app/view/Map.js | 38 | ||||
-rw-r--r-- | web/app/view/MapController.js | 18 | ||||
-rw-r--r-- | web/app/view/MapPickerDialogController.js | 12 | ||||
-rw-r--r-- | web/app/view/ServerDialog.js | 6 | ||||
-rw-r--r-- | web/app/view/UserDialog.js | 6 | ||||
-rw-r--r-- | web/l10n/en.json | 1 |
6 files changed, 24 insertions, 57 deletions
diff --git a/web/app/view/Map.js b/web/app/view/Map.js index ebc6bbb..f9bb625 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 57727f2..04e8c44 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 6a3b1a5..1dc48ea 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 bba5e72..13ddcb3 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 874f9f0..8df7f2f 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', diff --git a/web/l10n/en.json b/web/l10n/en.json index 4b06735..107f970 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -35,7 +35,6 @@ "sharedHourAbbreviation": "h", "sharedMinuteAbbreviation": "m", "sharedGetMapState": "Get Map State", - "sharedGetToggleState": "Get Toggle State", "sharedAttributeAlias": "Attribute Alias", "sharedAttributeAliases": "Attribute Aliases", "sharedAlias": "Alias", |