Skip to content

Commit

Permalink
turn the toggle button into mute button
Browse files Browse the repository at this point in the history
default is muted
  • Loading branch information
ninioe committed Jul 24, 2016
1 parent 3e1e90e commit 1e39c3d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions web/app/controller/Root.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ Ext.define('Traccar.controller.Root', {
this.beepSound.play();
},

showNotificationsSelected: function () {
return Ext.getCmp('showNotificationsButton') && Ext.getCmp('showNotificationsButton').pressed;
mutePressed: function () {
var muteButton = Ext.getCmp('nuteButton');
return muteButton && !muteButton.pressed;
},

asyncUpdate: function (first) {
Expand Down Expand Up @@ -192,10 +193,10 @@ Ext.define('Traccar.controller.Root', {
}
device = Ext.getStore('Devices').getById(array[i].deviceId);
if (typeof device !== 'undefined') {
if (self.showNotificationsSelected()) {
if (self.mutePressed()) {
self.beep();
Ext.toast(text, device.get('name'));
}
Ext.toast(text, device.get('name'));
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions web/app/view/Devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ Ext.define('Traccar.view.Devices', {
}, {
xtype: 'tbfill'
},{
id: 'showNotificationsButton',
glyph: 'xf0a2@FontAwesome',
tooltip: Strings.showNotifications,
id: 'nuteButton',
glyph: 'xf1f7@FontAwesome',
tooltip: Strings.nuteButton,
tooltipType: 'title',
pressed : true,
enableToggle: true,
listeners: {
toggle: function (button, pressed) {
if (pressed) {
button.setGlyph('xf0a2@FontAwesome');
} else {
button.setGlyph('xf1f7@FontAwesome');
} else {
button.setGlyph('xf0a2@FontAwesome');
}
},
scope: this
Expand Down
2 changes: 1 addition & 1 deletion web/l10n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sharedSearch": "Search",
"sharedGeofence": "Geofence",
"sharedGeofences": "Geofences",
"showNotifications": "Show Notifications",
"nuteButton": "Mute",
"sharedNotifications": "Notifications",
"sharedAttributes": "Attributes",
"sharedAttribute": "Attribute",
Expand Down

0 comments on commit 1e39c3d

Please sign in to comment.