Merge branch 'courseware' of https://github.com/FreeCodeCamp/freecodecamp into courseware

This commit is contained in:
Michael Q Larson
2015-02-05 15:34:08 -08:00
4 changed files with 19 additions and 6 deletions

View File

@ -59,8 +59,14 @@ exports.returnNextBonfire = function(req, res) {
next(err);
}
bonfire = bonfire.pop();
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, '-');
return res.redirect('/bonfires/' + nameString);
return res.redirect('../bonfires/' + nameString);
});
};

View File

@ -38,10 +38,13 @@ exports.returnNextCourseware = function(req, res) {
}
courseware = courseware.pop();
if (courseware === undefined) {
req.flash('errors', {
msg: "It looks like you've completed all the courses we have available. Good job!"
})
return res.redirect('../coursewares/intro');
}
nameString = courseware.name.toLowerCase().replace(/\s/g, '-');
return res.redirect('/coursewares/' + nameString);
return res.redirect('../coursewares/' + nameString);
});
};
@ -54,13 +57,17 @@ exports.returnIndividualCourseware = function(req, res, next) {
if (err) {
next(err);
}
if (courseware.length < 1) {
courseware = courseware.pop();
var dashedNameFull = courseware.name.toLowerCase().replace(/\s/g, '-');
if (dashedNameFull != dashedName) {
return res.redirect('../coursewares/' + dashedNameFull);
}
if (courseware.length < 1) {
req.flash('errors', {
msg: "404: We couldn't find a challenge with that name. Please double check the name."
});
return res.redirect('/coursewares')
} else {
courseware = courseware.pop();
res.render('coursewares/show', {
title: courseware.name,
dashedName: dashedName,

View File

@ -27,7 +27,7 @@ block content
.form-group
label.col-sm-2.control-label.wrappable(for='description') description:
.col-sm-10
textarea#description.form-control(name="description", rows=5, placeholder="Separate sentences by exactly one space only. Do not add in line breaks.")
textarea#description.form-control(name="description", rows=5, placeholder="Each \"paragraph\" needs to be separated by a line break(return key).")
.form-group
label.col-sm-2.control-label.wrappable(for='challengeSeed') challengeSeed:
.col-sm-10

View File

@ -26,7 +26,7 @@ block content
.form-group
label.col-sm-2.control-label.wrappable(for='description') description:
.col-sm-10
textarea#description.form-control(name="description", placeholder="Separate sentences by exactly one space only. Do not add in line breaks.")
textarea#description.form-control(name="description", rows=5, placeholder="Each \"paragraph\" needs to be separated by a line break(return key).")
.form-group
label.col-sm-2.control-label.wrappable(for='challengeSeed') challengeSeed:
.col-sm-10