Merge branch 'master' of github.com:FreeCodeCamp/freecodecamp

This commit is contained in:
Quincy Larson
2015-05-09 18:36:41 -07:00
10 changed files with 47 additions and 10 deletions

View File

@@ -235,8 +235,18 @@ exports.upvote = function(req, res, next) {
return next(err); return next(err);
} }
user = user.pop(); user = user.pop();
user.progressTimestamps.push(Date.now()); user.progressTimestamps.push(Date.now() || 0);
user.save(); user.save(function (err, user) {
req.user.save(function (err, user) {
if (err) {
return next(err);
}
});
req.user.progressTimestamps.push(Date.now() || 0);
if (err) {
return next(err);
}
});
}); });
return res.send(story); return res.send(story);
}); });
@@ -373,6 +383,12 @@ exports.storySubmission = function(req, res, next) {
if (err) { if (err) {
return res.status(500); return res.status(500);
} }
req.user.progressTimestamps.push(Date.now() || 0);
req.user.save(function (err, user) {
if (err) {
return next(err);
}
});
res.send(JSON.stringify({ res.send(JSON.stringify({
storyLink: story.storyLink.replace(/\s/g, '-').toLowerCase() storyLink: story.storyLink.replace(/\s/g, '-').toLowerCase()
})); }));

View File

@@ -358,6 +358,7 @@ exports.returnUser = function(req, res, next) {
githubProfile: user.profile.githubProfile, githubProfile: user.profile.githubProfile,
linkedinProfile: user.profile.linkedinProfile, linkedinProfile: user.profile.linkedinProfile,
codepenProfile: user.profile.codepenProfile, codepenProfile: user.profile.codepenProfile,
facebookProfile: user.profile.facebookProfile,
twitterHandle: user.profile.twitterHandle, twitterHandle: user.profile.twitterHandle,
bio: user.profile.bio, bio: user.profile.bio,
picture: user.profile.picture, picture: user.profile.picture,
@@ -453,6 +454,7 @@ exports.postUpdateProfile = function(req, res, next) {
user.profile.username = req.body.username.trim() || ''; user.profile.username = req.body.username.trim() || '';
user.profile.location = req.body.location.trim() || ''; user.profile.location = req.body.location.trim() || '';
user.profile.githubProfile = req.body.githubProfile.trim() || ''; user.profile.githubProfile = req.body.githubProfile.trim() || '';
user.profile.facebookProfile = req.body.facebookProfile.trim() || '';
user.profile.linkedinProfile = req.body.linkedinProfile.trim() || ''; user.profile.linkedinProfile = req.body.linkedinProfile.trim() || '';
user.profile.codepenProfile = req.body.codepenProfile.trim() || ''; user.profile.codepenProfile = req.body.codepenProfile.trim() || '';
user.profile.twitterHandle = req.body.twitterHandle.trim() || ''; user.profile.twitterHandle = req.body.twitterHandle.trim() || '';

View File

@@ -64,6 +64,10 @@ var userSchema = new mongoose.Schema({
twitterHandle: { twitterHandle: {
type: String, type: String,
default: '' default: ''
},
facebookProfile: {
type: String,
default: ''
} }
}, },
portfolio: { portfolio: {

View File

@@ -1065,6 +1065,10 @@ hr {
margin-right: -20px; margin-right: -20px;
} }
.profile-social-icons {
margin-left: 8px;
}
.border-radius-5 { .border-radius-5 {
border-radius: 5px; border-radius: 5px;
} }

View File

@@ -351,7 +351,8 @@
"Perform a search and replace on the sentence using the arguments provided and return the new sentence.", "Perform a search and replace on the sentence using the arguments provided and return the new sentence.",
"First argument is the sentence the perform the search and replace on.", "First argument is the sentence the perform the search and replace on.",
"Second argument is the word that you will be replacing (before).", "Second argument is the word that you will be replacing (before).",
"Third argument is what you will be replacing the second argument with (after)." "Third argument is what you will be replacing the second argument with (after).",
"NOTE: Preserve the case of the original word when you are replacing it. For example if you mean to replace the word 'Book' with the word 'dog', it should be replaced as 'Dog'"
], ],
"challengeSeed": "function replace(str, before, after) {\n return str;\r\n}\n\nreplace(\"A quick brown fox jumped over the lazy dog\", \"jumped\", \"leaped\");", "challengeSeed": "function replace(str, before, after) {\n return str;\r\n}\n\nreplace(\"A quick brown fox jumped over the lazy dog\", \"jumped\", \"leaped\");",
"MDNlinks" : ["Array.splice()", "String.replace()", "Array.join()"] "MDNlinks" : ["Array.splice()", "String.replace()", "Array.join()"]

View File

@@ -213,7 +213,7 @@
"difficulty": 0.13, "difficulty": 0.13,
"challengeSeed": "125671865", "challengeSeed": "125671865",
"description": [ "description": [
"jQuery is a powerful tool for manipulating HTML elements.", "jQuery is a powerful library built in JavaScript for manipulating HTML elements.",
"It's a lot easier to use than JavaScript itself, so we'll learn it first.", "It's a lot easier to use than JavaScript itself, so we'll learn it first.",
"It's also extremely popular with employers, so we're going to learn it well.", "It's also extremely popular with employers, so we're going to learn it well.",
"Codecademy has an excellent free course that will walk us through the basics of jQuery.", "Codecademy has an excellent free course that will walk us through the basics of jQuery.",

View File

@@ -143,6 +143,15 @@ block content
span.ion-close-circled span.ion-close-circled
| Please enter a valid URL format (http://www.example.com). | Please enter a valid URL format (http://www.example.com).
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='email') Facebook
.col-sm-4
input.form-control(type='url', name='facebookProfile', id='facebookProfile', autocomplete="off", ng-model='user.profile.facebookProfile', placeholder='http://')
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.facebookProfile.$error.url && !profileForm.facebookProfile.$pristine")
alert(type='danger')
span.ion-close-circled
| Please enter a valid URL format (http://www.example.com).
.form-group .form-group
.col-sm-offset-5.col-sm-4 .col-sm-offset-5.col-sm-4
button.btn.btn-primary.btn-block(type='submit', ng-disabled='profileForm.$invalid') button.btn.btn-primary.btn-block(type='submit', ng-disabled='profileForm.$invalid')

View File

@@ -22,15 +22,17 @@ block content
img.img-center.img-responsive.public-profile-img(src=picture) img.img-center.img-responsive.public-profile-img(src=picture)
else else
img.img-center.img-responsive.public-profile-img(src='https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png') img.img-center.img-responsive.public-profile-img(src='https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png')
h1.text-center.negative-5 h1.text-center.negative-5.profile-social-icons
- if (twitterHandle) - if (twitterHandle)
a.ion-social-twitter.text-primary(title="@#{username}'s Twitter Profile", href="http://twitter.com/#{twitterHandle}", target='_blank') a.fa.fa-twitter-square.text-primary(title="@#{username}'s Twitter Profile", href="http://twitter.com/#{twitterHandle}", target='_blank')
- if (githubProfile) - if (githubProfile)
a.ion-social-github.text-primary(title="@#{username}'s GitHub Profile", href=githubProfile, target='_blank') a.fa.fa-github-square.text-primary(title="@#{username}'s GitHub Profile", href=githubProfile, target='_blank')
- if (linkedinProfile)
a.ion-social-linkedin.text-primary(title="@#{username}'s LinkedIn Profile", href=linkedinProfile, target='_blank')
- if (codepenProfile) - if (codepenProfile)
a.ion-social-codepen.text-primary(title="@#{username}'s CodePen Profile", href=codepenProfile, target='_blank') a.ion-social-codepen.text-primary(title="@#{username}'s CodePen Profile", href=codepenProfile, target='_blank')
- if (linkedinProfile)
a.fa.fa-linkedin-square.text-primary(title="@#{username}'s LinkedIn Profile", href=linkedinProfile, target='_blank')
- if (facebookProfile)
a.fa.fa-facebook-square.text-primary(title="@#{username}'s Facebook Profile", href=facebookProfile, target='_blank')
.visible-md.visible-lg .visible-md.visible-lg
.col-xs-12.col-sm-12.col-md-4.text-justify .col-xs-12.col-sm-12.col-md-4.text-justify
h1.flat-top.wrappable= name h1.flat-top.wrappable= name

View File

@@ -1,6 +1,5 @@
extends ../layout extends ../layout
block content block content
script(src='/js/lib/moment/moment.js')
if (user) if (user)
script. script.
var isLoggedIn = true; var isLoggedIn = true;