mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
contrib: add name-tag colors based on contributor level
This commit is contained in:
@@ -96,7 +96,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
||||
}
|
||||
|
||||
$scope.deleteChatMessage = function(group, message){
|
||||
if(message.uuid === User.user.id || (User.user.backer && User.user.backer.admin)){
|
||||
if(message.uuid === User.user.id || (User.user.backer && User.user.contributor.admin)){
|
||||
Groups.Group.deleteChatMessage({gid: group._id, messageId: message.id}, undefined, function(){
|
||||
var i = _.indexOf(group.chat, message);
|
||||
if(i !== -1) group.chat.splice(i, 1);
|
||||
@@ -108,22 +108,6 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
||||
group.$get();
|
||||
}
|
||||
|
||||
$scope.nameTagClasses = function(message){
|
||||
if (!message) return; // fixme what's triggering this?
|
||||
if (message.contributor) {
|
||||
if (message.contributor.match(/npc/i) || message.contributor.match(/royal/i)) {
|
||||
return 'label-royal';
|
||||
} else if (message.contributor.match(/champion/i)) {
|
||||
return 'label-champion';
|
||||
} else if (message.contributor.match(/elite/i)) {
|
||||
return 'label-success'; //elite
|
||||
}
|
||||
}
|
||||
if (message.uuid == User.user.id) {
|
||||
return 'label-inverse'; //self
|
||||
}
|
||||
}
|
||||
|
||||
}])
|
||||
|
||||
.controller("GuildsCtrl", ['$scope', 'Groups', 'User', '$rootScope', '$state', '$location',
|
||||
|
||||
@@ -75,6 +75,16 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
||||
});
|
||||
}
|
||||
|
||||
$scope.contribText = function(contrib, backer){
|
||||
if (!contrib && !backer) return;
|
||||
if (backer && backer.npc) return backer.npc;
|
||||
var l = contrib && contrib.level;
|
||||
if (l && l > 0) {
|
||||
var level = (l < 3) ? 'Friend' : (l < 5) ? 'Elite' : (l < 7) ? 'Champion' : (l < 8) ? 'Legendary' : 'Heroic';
|
||||
return level + ' ' + contrib.text;
|
||||
}
|
||||
}
|
||||
|
||||
$rootScope.charts = {};
|
||||
$rootScope.toggleChart = function(id, task) {
|
||||
var history = [], matrix, data, chart, options;
|
||||
|
||||
Reference in New Issue
Block a user