Merge branch 'jameskopacz-patch-259' of https://github.com/jameskopacz/freecodecamp into ux-improvements

This commit is contained in:
Michael Q Larson
2015-03-29 14:19:12 -07:00
4 changed files with 13 additions and 3 deletions

4
app.js
View File

@ -213,7 +213,9 @@ app.use(function (req, res, next) {
app.use(function (req, res, next) { app.use(function (req, res, next) {
// Remember original destination before login. // Remember original destination before login.
var path = req.path.split('/')[1]; var path = req.path.split('/')[1];
if (/auth|login|logout|signup|fonts|favicon/i.test(path)) { if (/auth|login|logout|signin|signup|fonts|favicon/i.test(path)) {
return next();
} else if (/\/stories\/comments\/\w+/i.test(req.path)) {
return next(); return next();
} }
req.session.returnTo = req.path; req.session.returnTo = req.path;

View File

@ -154,6 +154,10 @@ $(document).ready(function() {
}); });
var upvoteHandler = function () { var upvoteHandler = function () {
if (typeof user == "undefined" || !user) {
window.location.href = '/signin';
return;
}
var _id = storyId; var _id = storyId;
$('#upvote').unbind('click'); $('#upvote').unbind('click');
var alreadyUpvoted = false; var alreadyUpvoted = false;

View File

@ -56,7 +56,8 @@
sentinel--; sentinel--;
if (!sentinel) { if (!sentinel) {
$('.comment-a-comment').on('click', 'a', function () { $('.comment-a-comment').on('click', 'a', function () {
if (!user) { if (typeof user == "undefined" || !user) {
window.location.href = '/signin';
return; return;
} }
$(this).unbind('click'); $(this).unbind('click');

View File

@ -56,7 +56,10 @@
$('#image-display').removeClass('hidden-element') $('#image-display').removeClass('hidden-element')
} }
$('#reply-to-main-post').on('click', function() { $('#reply-to-main-post').on('click', function() {
if (!user) return; if (typeof user == "undefined" || !user) {
window.location.href = '/signin';
return;
}
$('#initial-comment-submit').removeClass('hidden-element'); $('#initial-comment-submit').removeClass('hidden-element');
$(this).unbind('click'); $(this).unbind('click');
$('.comment-to-comment-formgroup').empty(); $('.comment-to-comment-formgroup').empty();