fix bug switch audio wasn't working

This commit is contained in:
Adrien Lemaire 2014-08-09 18:57:17 +09:00
parent a5f1e30880
commit d7aaec2262
3 changed files with 15 additions and 10 deletions

View file

@ -154,7 +154,7 @@
.toolbar-notifs-no-messages
padding: 0.382em 1em
// Settings dropdown
.toolbar-settings
.toolbar-settings, .toolbar-audio
@extend $hrpg-modal-dropdown-left
.toolbar-controls
@extend $hrpg-modal-controls
@ -166,7 +166,7 @@
@media screen and (max-width:768px)
.toolbar-toggle
display: none
.toolbar-mobile, .toolbar-settings
.toolbar-mobile, .toolbar-settings, .toolbar-audio
.toolbar-submenu
padding-left: 1em
display: block

View file

@ -79,7 +79,7 @@ angular.module('authCtrl', [])
// Using controller: 'AuthCtrl' it causes problems
});
}
}
};
$scope.passwordReset = function(email){
$http.post(API_URL + '/api/v2/user/reset-password', {email:email})
@ -89,10 +89,14 @@ angular.module('authCtrl', [])
.error(function(data){
alert(data.err);
});
}
};
$scope.expandMenu = function(menu) {
$scope._expandedMenu = ($scope._expandedMenu == menu) ? null : menu;
}
};
$scope.switchAudio = function(bool) {
User.set({"preferences.sound": bool});
};
}
]);

View file

@ -144,12 +144,13 @@ nav.toolbar(ng-controller='AuthCtrl', ng-class='{active: isToolbarHidden}')
div
ul.toolbar-submenu(ng-click='expandMenu(null)')
li
a(ng-if='user.preferences.sound', ng-click='set("preferences.sound",false)')
i.glyphicon.glyphicon-volume_down(tooltip=env.t('soundOff'))
li
a(ng-if='!user.preferences.sound', ng-click='set("preferences.sound",true)')
i.glyphicon.glyphicon-mute(tooltip=env.t('soundOn'))
label=env.t('switchSound')
a(ng-if='user.preferences.sound', ng-click='switchAudio(false)')
span.glyphicon.glyphicon-volume-down(tooltip=env.t('soundOff'))
a(ng-if='!user.preferences.sound', ng-click='switchAudio(true)')
span.glyphicon.glyphicon-volume-off(tooltip=env.t('soundOn'))
li
label(for='audioTheme')=env.t('selectTheme')
select#audioTheme(
style='width:140px',
ng-controller='SettingsCtrl',