diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index be95206e0f..f3a52e90d9 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -21,6 +21,16 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ return haystack && ~haystack.indexOf(needle); } + // styling helpers + $scope.userLevelStyle = function(user,style){ + style = style || ''; + if(user.backer.npc) + style += ' label-npc'; + if(user.contributor.level) + style += ' label-contributor-'+user.contributor.level; + return style; + } + // count pets, mounts collected totals, etc $rootScope.countExists = function(items) {return _.reduce(items,function(m,v){return m+(v?1:0)},0)} diff --git a/views/shared/header/avatar.jade b/views/shared/header/avatar.jade index 5d06782413..8655764885 100644 --- a/views/shared/header/avatar.jade +++ b/views/shared/header/avatar.jade @@ -27,5 +27,5 @@ figure.herobox(ng-click='clickMember(profile._id)', data-name='{{profile.profile // Pet // FIXME handle @minimal, this might have to be a directive span.current-pet(class='Pet-{{profile.items.currentPet}}', ng-show='profile.items.currentPet && !minimal') - .avatar-level(ng-class='{label:profile, "label-contributor- + profile.contributor.level": profile.contributor, "label-npc": profile.backer.npc}') + .avatar-level(ng-class='userLevelStyle(profile,"label")') | Lvl {{profile.stats.lvl}}