Add unallocated attribute points notification

* Uses i18n "haveUnallocated" string, to come in another commit
This commit is contained in:
Brian Chen 2014-10-04 19:57:30 +08:00
parent 74be4b211b
commit 9ecbe9d48f
2 changed files with 9 additions and 2 deletions

View file

@ -95,12 +95,14 @@ angular.module('authCtrl', [])
$scope._expandedMenu = ($scope._expandedMenu == menu) ? null : menu;
};
function selectNotificationValue(mysteryValue, invitationValue, messageValue, noneValue) {
function selectNotificationValue(mysteryValue, invitationValue, unallocatedValue, messageValue, noneValue) {
var user = $scope.user;
if (user.purchased.plan.mysteryItems.length) {
return mysteryValue;
} else if ((user.invitations.party && user.invitations.party.id) || user.invitations.guilds.length > 0) {
return invitationValue;
} else if (user.flags.classSelected && !(user.preferences && user.preferences.disableClasses) && user.stats.points) {
return unallocatedValue;
} else if (!(_.isEmpty(user.newMessages))) {
return messageValue;
} else {
@ -112,12 +114,13 @@ angular.module('authCtrl', [])
return selectNotificationValue(
"glyphicon-gift",
"glyphicon-user",
"glyphicon-plus-sign",
"glyphicon-comment",
"glyphicon-comment inactive");
};
$scope.hasNoNotifications = function() {
return selectNotificationValue(false, false, false, true);
return selectNotificationValue(false, false, false, false, true);
}
}
]);

View file

@ -155,6 +155,10 @@ nav.toolbar(ng-controller='AuthCtrl', ng-class='{active: isToolbarHidden}')
a(ui-sref='options.social.guilds', ng-click='expandMenu(null)')
span.glyphicon.glyphicon-user
span=env.t('invitedTo', {name: '{{guild.name}}'})
li(ng-if='user.flags.classSelected && !user.preferences.disableClasses && user.stats.points')
a(ui-sref='options.profile.stats', ng-click='expandMenu(null)')
span.glyphicon.glyphicon-plus-sign
span=env.t('haveUnallocated', {points: '{{user.stats.points}}'})
li(ng-repeat='(k,v) in user.newMessages', ng-if='v.value')
a(ng-click='k==party._id ? $state.go("options.social.party") : $state.go("options.social.guilds.detail",{gid:k}); expandMenu(null)')
span.glyphicon.glyphicon-comment