mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-03 08:21:07 +00:00
Merge pull request #4112 from betaveros/unallocated-notification
Notification for Unallocated Attribute Points (fixes #4109)
This commit is contained in:
commit
96b41448cd
2 changed files with 34 additions and 4 deletions
|
|
@ -94,5 +94,33 @@ angular.module('authCtrl', [])
|
|||
$scope.expandMenu = function(menu) {
|
||||
$scope._expandedMenu = ($scope._expandedMenu == menu) ? null : menu;
|
||||
};
|
||||
|
||||
function selectNotificationValue(mysteryValue, invitationValue, unallocatedValue, messageValue, noneValue) {
|
||||
var user = $scope.user;
|
||||
if (user.purchased && user.purchased.plan && user.purchased.plan.mysteryItems && user.purchased.plan.mysteryItems.length) {
|
||||
return mysteryValue;
|
||||
} else if ((user.invitations.party && user.invitations.party.id) || (user.invitations.guilds && 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 {
|
||||
return noneValue;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.iconClasses = function() {
|
||||
return selectNotificationValue(
|
||||
"glyphicon-gift",
|
||||
"glyphicon-user",
|
||||
"glyphicon-plus-sign",
|
||||
"glyphicon-comment",
|
||||
"glyphicon-comment inactive");
|
||||
};
|
||||
|
||||
$scope.hasNoNotifications = function() {
|
||||
return selectNotificationValue(false, false, false, false, true);
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -137,14 +137,12 @@ nav.toolbar(ng-controller='AuthCtrl', ng-class='{active: isToolbarHidden}')
|
|||
ul.toolbar-options
|
||||
li.toolbar-notifs
|
||||
a(ng-click='expandMenu("notifs")')
|
||||
span.glyphicon.glyphicon-comment(ng-if='!user.invitations.party.id && !user.purchased.plan.mysteryItems.length && user.invitations.guilds.length === 0', ng-class='{inactive: _.isEmpty(user.newMessages)}')
|
||||
span.glyphicon.glyphicon-user(ng-if='!user.purchased.plan.mysteryItems.length && (user.invitations.party.id || user.invitations.guilds.length > 0)')
|
||||
span.glyphicon.glyphicon-gift(ng-if='user.purchased.plan.mysteryItems.length')
|
||||
span.glyphicon(ng-class='iconClasses()')
|
||||
div(ng-if='_expandedMenu=="notifs"')
|
||||
h4=env.t('notifications')
|
||||
div
|
||||
ul.toolbar-notifs-notifs
|
||||
li.toolbar-notifs-no-messages(ng-if='!user.invitations.party.id && !user.purchased.plan.mysteryItems.length && user.invitations.guilds.length === 0 && _.isEmpty(user.newMessages)')=env.t('noNotifications')
|
||||
li.toolbar-notifs-no-messages(ng-if='hasNoNotifications()')=env.t('noNotifications')
|
||||
li(ng-if='user.purchased.plan.mysteryItems.length')
|
||||
a(ng-click='$state.go("options.inventory.drops"); expandMenu(null)')
|
||||
span.glyphicon.glyphicon-gift
|
||||
|
|
@ -157,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
|
||||
|
|
|
|||
Loading…
Reference in a new issue