mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
contrib: add name-tag colors based on contributor level
This commit is contained in:
@@ -26,15 +26,28 @@
|
|||||||
label
|
label
|
||||||
margin-right:5px
|
margin-right:5px
|
||||||
|
|
||||||
.label-elite
|
.own-message
|
||||||
|
border-left: 4px solid #333
|
||||||
|
padding-left: 2px
|
||||||
|
|
||||||
|
// Name tags
|
||||||
|
.label-contributor-1, .label-contributor-2
|
||||||
|
background-color: #333;
|
||||||
|
.label-contributor-3, .label-contributor-4
|
||||||
background-color: #077409
|
background-color: #077409
|
||||||
color: black
|
color: white
|
||||||
.label-champion
|
.label-contributor-5, .label-contributor-6
|
||||||
background-color: #125BA2
|
background-color: #125BA2
|
||||||
color: white
|
color: white
|
||||||
.label-royal
|
.label-contributor-7
|
||||||
background-color: #7313B4
|
background-color: #7313B4
|
||||||
color: white
|
color: white
|
||||||
|
.label-contributor-8
|
||||||
|
background-color: #ff8000
|
||||||
|
color: white
|
||||||
|
.label-npc
|
||||||
|
background-color: indianred
|
||||||
|
color: white
|
||||||
|
|
||||||
#market-tab
|
#market-tab
|
||||||
position relative
|
position relative
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.deleteChatMessage = function(group, message){
|
$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(){
|
Groups.Group.deleteChatMessage({gid: group._id, messageId: message.id}, undefined, function(){
|
||||||
var i = _.indexOf(group.chat, message);
|
var i = _.indexOf(group.chat, message);
|
||||||
if(i !== -1) group.chat.splice(i, 1);
|
if(i !== -1) group.chat.splice(i, 1);
|
||||||
@@ -108,22 +108,6 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
|||||||
group.$get();
|
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',
|
.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.charts = {};
|
||||||
$rootScope.toggleChart = function(id, task) {
|
$rootScope.toggleChart = function(id, task) {
|
||||||
var history = [], matrix, data, chart, options;
|
var history = [], matrix, data, chart, options;
|
||||||
|
|||||||
@@ -220,8 +220,8 @@ api.postChat = function(req, res, next) {
|
|||||||
var message = {
|
var message = {
|
||||||
id: helpers.uuid(),
|
id: helpers.uuid(),
|
||||||
uuid: user._id,
|
uuid: user._id,
|
||||||
contributor: user.backer && user.backer.contributor,
|
contributor: user.contributor && user.contributor.toObject(),
|
||||||
npc: user.backer && user.backer.npc,
|
backer: user.backer && user.backer.toObject(),
|
||||||
text: req.query.message, // FIXME this should be body, but ngResource is funky
|
text: req.query.message, // FIXME this should be body, but ngResource is funky
|
||||||
user: user.profile.name,
|
user: user.profile.name,
|
||||||
timestamp: +(new Date)
|
timestamp: +(new Date)
|
||||||
@@ -237,7 +237,6 @@ api.postChat = function(req, res, next) {
|
|||||||
|
|
||||||
group.save(function(err, saved){
|
group.save(function(err, saved){
|
||||||
if (err) return res.json(500, {err:err});
|
if (err) return res.json(500, {err:err});
|
||||||
|
|
||||||
res.json({chat: saved.chat});
|
res.json({chat: saved.chat});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -249,7 +248,7 @@ api.deleteChatMessage = function(req, res){
|
|||||||
|
|
||||||
if(!message) return res.json(404, {err: "Message not found!"});
|
if(!message) return res.json(404, {err: "Message not found!"});
|
||||||
|
|
||||||
if(user._id !== message.uuid && !(user.backer && user.backer.admin))
|
if(user._id !== message.uuid && !(user.backer && user.contributor.admin))
|
||||||
return res.json(401, {err: "Not authorized to delete this message!"})
|
return res.json(401, {err: "Not authorized to delete this message!"})
|
||||||
|
|
||||||
Group.update({_id:group._id}, {$pull:{chat:{id: req.params.messageId}}}, function(err){
|
Group.update({_id:group._id}, {$pull:{chat:{id: req.params.messageId}}}, function(err){
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
li(ng-repeat='message in group.chat', ng-class='{highlight: indexOf(message.text, user.profile.name)}')
|
li(ng-repeat='message in group.chat', ng-class='{highlight: indexOf(message.text, user.profile.name), "own-message": user._id == message.uuid}')
|
||||||
a.label.chat-message(class='{{nameTagClasses(message)}}', tooltip='{{message.contributor}}', ng-click='clickMember(message.uuid, true)')
|
a.label.chat-message(class='label-contributor-{{message.contributor.level}}', ng-class='{"label-npc": message.backer.npc}', ng-click='clickMember(message.uuid, true)')
|
||||||
| {{message.user}}
|
span(tooltip='{{contribText(message.contributor, message.backer)}}') {{message.user}}
|
||||||
span
|
|
|
||||||
span(ng-bind-html="message.text | linky:'_blank'") -
|
span(ng-bind-html="message.text | linky:'_blank'")
|
||||||
span
|
| -
|
||||||
span.muted.time
|
span.muted.time
|
||||||
| {{relativeDate(message.timestamp, _currentTime) + ' '}}
|
| {{relativeDate(message.timestamp, _currentTime) + ' '}}
|
||||||
a(ng-show='user.backer.admin || message.uuid == user.id', ng-click='deleteChatMessage(group, message)')
|
a(ng-show='user.contributor.admin || message.uuid == user.id', ng-click='deleteChatMessage(group, message)')
|
||||||
i.icon-remove(tooltip='Delete')
|
i.icon-remove(tooltip='Delete')
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ div(ng-controller='MemberModalCtrl')
|
|||||||
.modal-header
|
.modal-header
|
||||||
h3
|
h3
|
||||||
span {{profile.profile.name}}
|
span {{profile.profile.name}}
|
||||||
span(ng-show='profile.backer.contributor') - {{profile.backer.contributor}}
|
span(ng-if='profile.contributor.level') - {{contribText(profile.contributor, profile.backer)}}
|
||||||
.modal-body
|
.modal-body
|
||||||
.row-fluid
|
.row-fluid
|
||||||
.span6
|
.span6
|
||||||
|
|||||||
@@ -16,16 +16,16 @@
|
|||||||
div(ng-if='profile.backer.npc')
|
div(ng-if='profile.backer.npc')
|
||||||
.achievement.achievement-helm
|
.achievement.achievement-helm
|
||||||
h5
|
h5
|
||||||
span.label.label-master {{profile.backer.npc}} NPC
|
span.label.label-npc {{profile.backer.npc}} NPC
|
||||||
small Backed the Kickstarter project at the maximum level!
|
small Backed the Kickstarter project at the maximum level!
|
||||||
hr
|
hr
|
||||||
|
|
||||||
div(ng-if='profile.backer.contributor || user._id == profile._id')
|
div(ng-if='profile.contributor.level || user._id == profile._id')
|
||||||
.achievement.achievement-firefox(ng-show='profile.backer.contributor')
|
.achievement.achievement-firefox(ng-if='profile.contributor.level')
|
||||||
div(ng-class='{muted: !profile.backer.contributor}')
|
div(ng-class='{muted: !profile.contributor.level}')
|
||||||
h5
|
h5
|
||||||
span.label.label-inverse(ng-if='profile.backer.contributor') {{profile.backer.contributor}}
|
span.label(ng-if='profile.contributor.level', class='label-contributor-{{profile.contributor.level}}') {{contribText(profile.contributor, profile.backer)}}
|
||||||
span.label(ng-if='!profile.backer.contributor') Contributor
|
span.label(ng-if='!profile.contributor.level') Contributor
|
||||||
small.
|
small.
|
||||||
Has contributed to HabitRPG (code, design, pixel art, legal advice, docs, etc). Want this badge? Fix a bug :)
|
Has contributed to HabitRPG (code, design, pixel art, legal advice, docs, etc). Want this badge? Fix a bug :)
|
||||||
hr
|
hr
|
||||||
|
|||||||
Reference in New Issue
Block a user