fix for #1920, again. this is very 'un-angular' but it *actually* works. the proper way to do this is make a directive for 'userlevel' or something and have that apply the proper styles

This commit is contained in:
Nick Gordon
2013-11-26 14:56:24 -08:00
parent 2b128f71f4
commit 86f62ac2b2
2 changed files with 11 additions and 1 deletions

View File

@@ -21,6 +21,16 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
return haystack && ~haystack.indexOf(needle); 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 // count pets, mounts collected totals, etc
$rootScope.countExists = function(items) {return _.reduce(items,function(m,v){return m+(v?1:0)},0)} $rootScope.countExists = function(items) {return _.reduce(items,function(m,v){return m+(v?1:0)},0)}

View File

@@ -27,5 +27,5 @@ figure.herobox(ng-click='clickMember(profile._id)', data-name='{{profile.profile
// Pet // Pet
// FIXME handle @minimal, this might have to be a directive // FIXME handle @minimal, this might have to be a directive
span.current-pet(class='Pet-{{profile.items.currentPet}}', ng-show='profile.items.currentPet && !minimal') 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}} | Lvl {{profile.stats.lvl}}