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

This commit is contained in:
Quincy Larson
2015-05-26 09:08:43 -07:00
18 changed files with 61 additions and 44 deletions

View File

@ -110,7 +110,7 @@ Project Structure
| **models**/Challenge.js | Mongoose schema and model for Challenge. |
| **public**/ | Static assets (fonts, css, js, img). |
| **public**/**js**/application.js | Specify client-side JavaScript dependencies. |
| **public**/**js**/main.js | Place your client-side JavaScript here. |
| **public**/**js**/main_0.0.2.js | Place your client-side JavaScript here. |
| **public**/**css**/main.less | Main stylesheet for the app. |
| **views/account**/ | Templates for *login, password reset, signup, profile*. |
| **views/partials**/flash.jade | Error, info and success flash notifications. |

View File

@ -147,10 +147,12 @@ exports.returnCurrentChallenge = function(req, res, next) {
exports.returnIndividualChallenge = function(req, res, next) {
var dashedName = req.params.challengeName;
var challengeName = dashedName.replace(/\-/g, ' ')
.split(' ')
.slice(1)
.join(' ');
var challengeName = /^(bonfire|waypoint|zipline|basejump)/i.test(dashedName) ? dashedName
.replace(/\-/g, ' ')
.split(' ')
.slice(1)
.join(' ')
: dashedName.replace(/\-/g, ' ');
Challenge.find({'name': new RegExp(challengeName, 'i')},
function(err, challengeFromMongo) {
@ -455,6 +457,8 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
var solutionLink = req.body.challengeInfo.publicURL;
var githubLink = req.body.challengeInfo.challengeType === '4'
? req.body.challengeInfo.githubURL : true;
var challengeType = req.body.challengeInfo.challengeType === '4' ?
4 : 3;
if (!solutionLink || !githubLink) {
req.flash('errors', {
msg: 'You haven\'t supplied the necessary URLs for us to inspect ' +
@ -485,6 +489,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
completedDate: isCompletedDate,
solution: solutionLink,
githubLink: githubLink,
challengeType: challengeType,
verified: false
});
@ -510,6 +515,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
completedDate: isCompletedDate,
solution: solutionLink,
githubLink: githubLink,
challengeType: challengeType,
verified: false
});
pairedWith.save(function (err, paired) {
@ -532,6 +538,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
completedDate: isCompletedDate,
solution: solutionLink,
githubLink: githubLink,
challengeType: challengeType,
verified: false
});

View File

@ -398,8 +398,8 @@ exports.returnUser = function(req, res, next) {
user.currentStreak = user.currentStreak || 1;
user.longestStreak = user.longestStreak || 1;
var challenges = user.completedCoursewares.filter(function ( obj ) {
return !!obj.solution;
var challenges = user.completedChallenges.filter(function ( obj ) {
return obj.challengeType === 3 || obj.challengeType === 4;
});
res.render('account/show', {

View File

@ -56,7 +56,7 @@ var allTests = '';
});
})();
var otherTestsForNow = "<script src='/js/lib/coursewares/iFrameScripts_0.0.1.js'></script>";
var otherTestsForNow = "<script src='/js/lib/coursewares/iFrameScripts_0.0.2.js'></script>";
var delay;
// Initialize CodeMirror editor with a nice html5 canvas demo.

View File

@ -194,7 +194,7 @@ var createTestDisplay = function() {
var expect = chai.expect;
var assert = chai.assert;
var should = chai.should;
var should = chai.should();
var reassembleTest = function(test, data) {

View File

@ -17,6 +17,7 @@ $(document).ready(function() {
setCSRFToken($('meta[name="csrf-token"]').attr('content'));
$('#i-want-help').on('click', function() {
/*
var editorValue = editor.getValue();
var currentLocation = window.location.href;
$.post(
@ -33,9 +34,11 @@ $(document).ready(function() {
}
}
);
*/
});
$('#i-want-help-editorless').on('click', function() {
/*
var currentLocation = window.location.href;
$.post(
'/get-help',
@ -50,6 +53,7 @@ $(document).ready(function() {
}
}
);
*/
});
$('#report-issue').on('click', function() {

View File

@ -836,7 +836,7 @@
"expect(smallestCommons([1,5])).to.be.a('number');",
"expect(smallestCommons([1,5])).to.equal(60);",
"expect(smallestCommons([5,1])).to.equal(60);",
"(smallestCommons([1,13])).should.equal(360360);"
"expect(smallestCommons([1,13])).to.equal(360360);"
],
"MDNlinks" : ["Smallest Common Multiple"],
"challengeType": 5
@ -866,7 +866,7 @@
},
{
"_id": "a5deed1811a43193f9f1c841",
"name": "Bonfire: Drop it like it's hot",
"name": "Bonfire: Drop it",
"difficulty": "2.13",
"description": [
"Drop the elements of an array (first argument), starting from the front, until the predicate (second argument) returns true.",

View File

@ -3,10 +3,20 @@ require('dotenv').load();
var User = require('../models/User.js'),
secrets = require('../config/secrets'),
mongoose = require('mongoose'),
R = require('ramda');
R = require('ramda'),
ziplines = require('./challenges/ziplines.json'),
basejumps = require('./challenges/basejumps.json');
mongoose.connect(secrets.db);
var ziplineIds = ziplines.challenges.map(function(elem) {
return elem._id;
});
var basejumpIds = basejumps.challenges.map(function(elem) {
return elem._id;
});
var ziplineAndBaseJumpIds = R.concat(ziplineIds, basejumpIds);
function userModelAssurity(cb) {
console.log('userModelAssurity');
var i = 1;
@ -91,23 +101,22 @@ function userModelMigration(cb) {
}
*/
user.needsMigration = false;
user.completedChallenges = R.filter(function(elem) {
return elem; // getting rid of undefined
}, R.concat(
user.completedCoursewares,
user.completedBonfires.map(function(bonfire) {
user.completedChallenges = user.completedChallenges.map(function(elem) {
if (ziplineAndBaseJumpIds.indexOf(elem._id) > 0) {
return ({
completedDate: bonfire.completedDate,
_id: bonfire._id,
name: bonfire.name,
completedWith: bonfire.completedWith,
solution: bonfire.solution,
githubLink: '',
verified: false,
challengeType: 5
_id: elem._id,
name: elem.name,
completedWith: elem.completedWith,
completedDate: elem.completedDate,
solution: elem.solution,
githubLink: elem.githubLink,
verified: elem.verified,
challengeType: typeof elem.githubLink === 'boolean' ? 4 : 3
});
})
));
} else {
return elem;
}
});
var self = this;
user.save(function (err) {

View File

@ -150,7 +150,7 @@ block content
td.col-xs-4= challenge.name
td.col-xs-2= moment(challenge.completedDate, 'x').format("MMM DD, YYYY")
td.col-xs-6
a(href=challenge.solution, target='_blank') View my solution
a(href="http://" + challenge.solution, target='_blank') View my solution
br
- if (bonfires.length > 0)

View File

@ -1,9 +1,6 @@
extends ../layout
block content
script.
var waypointList = !{JSON.stringify(waypoints)};
var ziplineList = !{JSON.stringify(ziplines)};
var basejumpList = !{JSON.stringify(basejumps)};
var completedChallenges = !{JSON.stringify(completedChallengeList)};
.panel.panel-info
.panel-heading.text-center

View File

@ -94,9 +94,9 @@ block content
if (user && user.sentSlackInvite)
.button-spacer
.btn-group.input-group.btn-group-justified
label.btn.btn-success#i-want-help
label.btn.btn-success#i-want-help(disabled)
i.fa.fa-medkit
| &nbsp; Help
| &nbsp; Help(disabled)
label.btn.btn-success#i-want-to-pair
i.fa.fa-user-plus
| &nbsp; Pair
@ -125,7 +125,7 @@ block content
form.code
.form-group.codeMirrorView
textarea#codeEditor(autofocus=true, style='display: none;')
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.2.js')
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.4.js')
#complete-courseware-dialog.modal(tabindex='-1')
.modal-dialog.animated.zoomIn.fast-animation

View File

@ -46,9 +46,9 @@ block content
if (user.sentSlackInvite)
.button-spacer
.btn-group.input-group.btn-group-justified
label.btn.btn-success#i-want-help
label.btn.btn-success#i-want-help(disabled)
i.fa.fa-medkit
| &nbsp; Help
| &nbsp; Help(disabled)
label.btn.btn-success#report-issue
i.fa.fa-bug
| &nbsp; Bug
@ -91,4 +91,4 @@ block content
.animated.zoomInDown.delay-half
span.completion-icon.ion-checkmark-circled.text-primary
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
script(src="/js/lib/coursewares/coursewaresHCJQFramework_0.1.2.js")
script(src="/js/lib/coursewares/coursewaresHCJQFramework_0.1.3.js")

View File

@ -67,7 +67,7 @@ block content
form.code
.form-group.codeMirrorView
textarea#codeEditor(autofocus=true, style='display: none;')
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.2.js')
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.4.js')
#complete-courseware-dialog.modal(tabindex='-1')
.modal-dialog.animated.zoomIn.fast-animation
.modal-content

View File

@ -23,9 +23,9 @@ block content
.button-spacer
if (user.sentSlackInvite)
.btn-group.input-group.btn-group-justified
.btn.btn-success.btn-big#i-want-help-editorless
.btn.btn-success.btn-big#i-want-help-editorless(disabled)
i.fa.fa-medkit
| &nbsp; Get help
| &nbsp; Get help(disabled)
.btn.btn-success.btn-big#report-issue
i.fa.fa-bug
| &nbsp; Report a bug

View File

@ -21,9 +21,9 @@ block content
if (user.sentSlackInvite)
.button-spacer
.btn-group.input-group.btn-group-justified
.btn.btn-success.btn-big#i-want-help-editorless
.btn.btn-success.btn-big#i-want-help-editorless(disabled)
i.fa.fa-medkit
| &nbsp; Help
| &nbsp; Help(disabled)
.btn.btn-success.btn-big#i-want-to-pair
i.fa.fa-user-plus
| &nbsp; Pair

View File

@ -23,7 +23,7 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
a(href='/chat', target='_blank') Chat
else
li
a(href='/challenges/join-our-chat-room') Chat
a(href='/challenges/waypoint-join-our-chat-room') Chat
li
a(href='/news') News
li

View File

@ -32,7 +32,7 @@ script.
window.moment || document.write('<script src="/bower_components/moment/min/moment.min.js"><\/script>');
// Leave the below lines alone!
script(src="/js/main.js")
script(src="/js/main_0.0.2.js")
script(src="/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js")