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);
}
// 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)}