add bonfires back in but now they are only visible to their creators

This commit is contained in:
Quincy Larson
2015-08-18 14:53:18 -07:00
parent 0d0528a743
commit b667a776ea
2 changed files with 23 additions and 0 deletions

View File

@ -155,6 +155,10 @@ module.exports = function(app) {
return obj.challengeType === 3 || obj.challengeType === 4; return obj.challengeType === 3 || obj.challengeType === 4;
}); });
const bonfires = user.completedChallenges.filter(function(obj) {
return obj.challengeType === 5 && obj.name.match(/Bonfire/g);
});
res.render('account/show', { res.render('account/show', {
title: 'Camper ' + user.username + '\'s portfolio', title: 'Camper ' + user.username + '\'s portfolio',
username: user.username, username: user.username,
@ -171,6 +175,7 @@ module.exports = function(app) {
progressTimestamps: user.progressTimestamps, progressTimestamps: user.progressTimestamps,
calender: data, calender: data,
challenges: challenges, challenges: challenges,
bonfires: bonfires,
moment: moment, moment: moment,
longestStreak: user.longestStreak, longestStreak: user.longestStreak,
currentStreak: user.currentStreak currentStreak: user.currentStreak

View File

@ -94,3 +94,21 @@ block content
td.col-xs-2= moment(challenge.completedDate, 'x').format("MMM DD, YYYY") td.col-xs-2= moment(challenge.completedDate, 'x').format("MMM DD, YYYY")
td.col-xs-6 td.col-xs-6
a(href=challenge.solution, target='_blank') View my solution a(href=challenge.solution, target='_blank') View my solution
if (user && user.username === username)
br
if (bonfires.length > 0)
.col-sm-12
table.table.table-striped
thead
tr
th.col-xs-4 Bonfire
th.col-xs-2 Completed
th.col-xs-6 Solution
for bonfire in bonfires
tr
td.col-xs-4
a(href='/challenges/' + bonfire.name, target='_blank')= bonfire.name
td.col-xs-2= moment(bonfire.completedDate, 'x').format("MMM DD, YYYY")
td.col-xs-6
pre.wrappable= bonfire.solution
br