Added group type to challenge API, link to guild/party on challenges

This commit is contained in:
Kevin Gisi
2015-04-06 02:44:43 -04:00
parent 145f4c0fa7
commit 6cfdfc5225
2 changed files with 7 additions and 3 deletions

View File

@@ -40,7 +40,7 @@ api.list = function(req, res, next) {
.select('name leader description group memberCount prize official') .select('name leader description group memberCount prize official')
.select({members:{$elemMatch:{$in:[user._id]}}}) .select({members:{$elemMatch:{$in:[user._id]}}})
.sort('-official -timestamp') .sort('-official -timestamp')
.populate('group', '_id name') .populate('group', '_id name type')
.populate('leader', 'profile.name') .populate('leader', 'profile.name')
.exec(cb); .exec(cb);
} }
@@ -63,7 +63,7 @@ api.get = function(req, res, next) {
// 3) Limit 30 (only show the 30 users currently in the lead) // 3) Limit 30 (only show the 30 users currently in the lead)
Challenge.findById(req.params.cid) Challenge.findById(req.params.cid)
.populate('members', 'profile.name _id') .populate('members', 'profile.name _id')
.populate('group', '_id name') .populate('group', '_id name type')
.populate('leader', 'profile.name') .populate('leader', 'profile.name')
.exec(function(err, challenge){ .exec(function(err, challenge){
if(err) return next(err); if(err) return next(err);

View File

@@ -143,7 +143,11 @@ script(type='text/ng-template', id='partials/options.social.challenges.html')
ul.pull-right.challenge-accordion-header-specs ul.pull-right.challenge-accordion-header-specs
li.bg-transparent(ng-if='challenge.official') li.bg-transparent(ng-if='challenge.official')
span.label.label-success=env.t('officialChallenge') span.label.label-success=env.t('officialChallenge')
li {{challenge.group.name}} li
a(ui-sref="options.social.guilds.detail({gid:challenge.group._id})" ng-if="challenge.group.type=='guild'")
| {{challenge.group.name}}
a(ui-sref="options.social.party" ng-if="challenge.group.type=='party'")
| {{challenge.group.name}}
li li
=env.t('by') + ' ' =env.t('by') + ' '
a(ng-click='clickMember(challenge.leader._id, true)') {{challenge.leader.profile.name}} a(ng-click='clickMember(challenge.leader._id, true)') {{challenge.leader.profile.name}}