Merge branch 'master' into courseware
Conflicts: controllers/bonfire.js controllers/resources.json views/bonfire/show.jade
This commit is contained in:
@@ -62,7 +62,7 @@ exports.returnNextBonfire = function(req, res) {
|
||||
if (bonfire === undefined) {
|
||||
req.flash('errors', {
|
||||
msg: "It looks like you've completed all the bonfires we have available. Good job!"
|
||||
})
|
||||
});
|
||||
return res.redirect('../bonfires/meet-bonfire');
|
||||
}
|
||||
nameString = bonfire.name.toLowerCase().replace(/\s/g, '-');
|
||||
@@ -79,38 +79,43 @@ exports.returnIndividualBonfire = function(req, res, next) {
|
||||
if (err) {
|
||||
next(err);
|
||||
}
|
||||
|
||||
|
||||
if (bonfire.length < 1) {
|
||||
req.flash('errors', {
|
||||
msg: "404: We couldn't find a bonfire with that name. Please double check the name."
|
||||
});
|
||||
|
||||
return res.redirect('/bonfires');
|
||||
}
|
||||
|
||||
bonfire = bonfire.pop()
|
||||
var dashedNameFull = bonfire.name.toLowerCase().replace(/\s/g, '-');
|
||||
if (dashedNameFull != dashedName) {
|
||||
return res.redirect('../bonfires/' + dashedNameFull);
|
||||
}
|
||||
if (bonfire.length < 1) {
|
||||
req.flash('errors', {
|
||||
msg: "404: We couldn't find a bonfire with that name. Please double check the name."
|
||||
});
|
||||
return res.redirect('/bonfires')
|
||||
} else {
|
||||
res.render('bonfire/show', {
|
||||
completedWith: null,
|
||||
title: bonfire.name,
|
||||
dashedName: dashedName,
|
||||
name: bonfire.name,
|
||||
difficulty: Math.floor(+bonfire.difficulty),
|
||||
brief: bonfire.description[0],
|
||||
details: bonfire.description.slice(1),
|
||||
tests: bonfire.tests,
|
||||
challengeSeed: bonfire.challengeSeed,
|
||||
challengeEntryPoint: bonfire.challengeEntryPoint,
|
||||
cc: !!req.user,
|
||||
points: req.user ? req.user.points : undefined,
|
||||
verb: resources.randomVerb(),
|
||||
phrase: resources.randomPhrase(),
|
||||
compliment: resources.randomCompliment(),
|
||||
bonfires: bonfire,
|
||||
bonfireHash: bonfire._id
|
||||
|
||||
});
|
||||
}
|
||||
res.render('bonfire/show', {
|
||||
completedWith: null,
|
||||
title: bonfire.name,
|
||||
dashedName: dashedName,
|
||||
name: bonfire.name,
|
||||
difficulty: Math.floor(+bonfire.difficulty),
|
||||
brief: bonfire.description[0],
|
||||
details: bonfire.description.slice(1),
|
||||
tests: bonfire.tests,
|
||||
challengeSeed: bonfire.challengeSeed,
|
||||
challengeEntryPoint: bonfire.challengeEntryPoint,
|
||||
cc: !!req.user,
|
||||
points: req.user ? req.user.points : undefined,
|
||||
verb: resources.randomVerb(),
|
||||
phrase: resources.randomPhrase(),
|
||||
compliment: resources.randomCompliment(),
|
||||
bonfires: bonfire,
|
||||
bonfireHash: bonfire._id
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user