User facing challenge mentions now point to coursewares, remove completed view from account/show

This commit is contained in:
Nathan Leniz
2015-03-21 18:42:19 +09:00
parent 9cdb2588b4
commit ac511982a4
8 changed files with 33 additions and 106 deletions

View File

@@ -23,7 +23,7 @@ exports.showAllCoursewares = function(req, res) {
exports.returnNextCourseware = function(req, res) {
if (!req.user) {
return res.redirect('../coursewares/start-our-challenges');
return res.redirect('../challenges/learn-how-free-code-camp-works');
}
var completed = req.user.completedCoursewares.map(function (elem) {
return elem._id;
@@ -50,10 +50,10 @@ exports.returnNextCourseware = function(req, res) {
req.flash('errors', {
msg: "It looks like you've completed all the courses we have available. Good job!"
});
return res.redirect('../coursewares/start-our-challenges');
return res.redirect('../challenges/learn-how-free-code-camp-works');
}
nameString = courseware.name.toLowerCase().replace(/\s/g, '-');
return res.redirect('../coursewares/' + nameString);
return res.redirect('../challenges/' + nameString);
});
};
@@ -71,14 +71,14 @@ exports.returnIndividualCourseware = function(req, res, next) {
req.flash('errors', {
msg: "404: We couldn't find a challenge with that name. Please double check the name."
});
return res.redirect('/coursewares')
return res.redirect('/challenges');
}
courseware = courseware.pop();
// Redirect to full name if the user only entered a partial
var dashedNameFull = courseware.name.toLowerCase().replace(/\s/g, '-');
if (dashedNameFull != dashedName) {
return res.redirect('../coursewares/' + dashedNameFull);
return res.redirect('../challenges/' + dashedNameFull);
}
var challengeType = {