Update views for new variable names. Get profile view working. Update challenge map.
This commit is contained in:
27
app.js
27
app.js
@ -494,35 +494,12 @@ app.get('/api/codepen/twitter/:screenName', resourcesController.codepenResources
|
||||
/**
|
||||
* Bonfire related routes
|
||||
*/
|
||||
|
||||
app.get('/field-guide/getFieldGuideList', fieldGuideController.showAllFieldGuides);
|
||||
|
||||
app.get('/playground', bonfireController.index);
|
||||
|
||||
app.get('/bonfires', bonfireController.returnNextBonfire);
|
||||
|
||||
app.get('/bonfire-json-generator', bonfireController.returnGenerator);
|
||||
|
||||
app.post('/bonfire-json-generator', bonfireController.generateChallenge);
|
||||
|
||||
app.get('/bonfire-challenge-generator', bonfireController.publicGenerator);
|
||||
|
||||
app.post('/bonfire-challenge-generator', bonfireController.testBonfire);
|
||||
|
||||
app.get(
|
||||
'/bonfires/:bonfireName',
|
||||
bonfireController.returnIndividualBonfire
|
||||
);
|
||||
|
||||
app.get('/bonfire', function(req, res) {
|
||||
res.redirect(301, '/playground');
|
||||
});
|
||||
|
||||
app.post('/completed-bonfire/', bonfireController.completedBonfire);
|
||||
app.post('/completed-bonfire/', challengeController.completedBonfire);
|
||||
|
||||
/**
|
||||
* Field Guide related routes
|
||||
*/
|
||||
app.get('/field-guide/getFieldGuideList', fieldGuideController.showAllFieldGuides);
|
||||
|
||||
|
||||
app.get('/field-guide/:fieldGuideName',
|
||||
|
@ -26,10 +26,23 @@ var debug = require('debug')('freecc:cntr:courseware'),
|
||||
var challengeMapWithNames = resources.getChallengeMapWithNames();
|
||||
var challengeMapWithIds = resources.getChallengeMapWithIds();
|
||||
|
||||
function getMDNlinks(links) {
|
||||
// takes in an array of links, which are strings
|
||||
var populatedLinks = [];
|
||||
|
||||
// for each key value, push the corresponding link from the MDNlinks object into a new array
|
||||
if (links) {
|
||||
links.forEach(function (value, index) {
|
||||
populatedLinks.push(MDNlinks[value]);
|
||||
});
|
||||
}
|
||||
return populatedLinks;
|
||||
}
|
||||
|
||||
exports.showAllChallenges = function(req, res) {
|
||||
var completedList = [];
|
||||
if (req.user) {
|
||||
completedList = req.user.completedCoursewares.map(function (elem) {
|
||||
completedList = req.user.completedChallenges.map(function (elem) {
|
||||
return elem._id;
|
||||
});
|
||||
}
|
||||
@ -150,7 +163,6 @@ exports.returnIndividualChallenge = function(req, res, next) {
|
||||
return res.redirect('/challenges');
|
||||
}
|
||||
var challenge = challengeFromMongo.pop();
|
||||
|
||||
// Redirect to full name if the user only entered a partial
|
||||
var dashedNameFull = challenge.name.toLowerCase().replace(/\s/g, '-');
|
||||
if (dashedNameFull !== dashedName) {
|
||||
@ -256,7 +268,25 @@ exports.returnIndividualChallenge = function(req, res, next) {
|
||||
},
|
||||
|
||||
5: function() {
|
||||
// bonfire
|
||||
res.render('bonfire/show', {
|
||||
completedWith: null,
|
||||
title: challenge.name,
|
||||
dashedName: dashedName,
|
||||
name: challenge.name,
|
||||
difficulty: Math.floor(+challenge.difficulty),
|
||||
brief: challenge.description.shift(),
|
||||
details: challenge.description,
|
||||
tests: challenge.tests,
|
||||
challengeSeed: challenge.challengeSeed,
|
||||
verb: resources.randomVerb(),
|
||||
phrase: resources.randomPhrase(),
|
||||
compliment: resources.randomCompliment(),
|
||||
bonfires: challenge,
|
||||
challengeId: challenge._id,
|
||||
MDNkeys: challenge.MDNlinks,
|
||||
MDNlinks: getMDNlinks(challenge.MDNlinks),
|
||||
challengeType: challenge.challengeType
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -266,7 +296,96 @@ exports.returnIndividualChallenge = function(req, res, next) {
|
||||
};
|
||||
|
||||
exports.completedBonfire = function (req, res, next) {
|
||||
var isCompletedWith = req.body.challengeInfo.completedWith || '';
|
||||
var isCompletedDate = Math.round(+new Date());
|
||||
var challengeId = req.body.challengeInfo.challengeId;
|
||||
var isSolution = req.body.challengeInfo.solution;
|
||||
var challengeName = req.body.challengeInfo.challengeName;
|
||||
|
||||
if (isCompletedWith) {
|
||||
var paired = User.find({'profile.username': isCompletedWith
|
||||
.toLowerCase()}).limit(1);
|
||||
paired.exec(function (err, pairedWith) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
} else {
|
||||
var index = req.user.uncompletedChallenges.indexOf(challengeId);
|
||||
debug('This is the index', index);
|
||||
if (index > -1) {
|
||||
req.user.progressTimestamps.push(Date.now() || 0);
|
||||
req.user.uncompletedChallenges.splice(index, 1);
|
||||
}
|
||||
pairedWith = pairedWith.pop();
|
||||
|
||||
index = pairedWith.uncompletedChallenges.indexOf(challengeId);
|
||||
debug('This is the index of the search for bonfire', index);
|
||||
if (index > -1) {
|
||||
pairedWith.progressTimestamps.push(Date.now() || 0);
|
||||
pairedWith.uncompletedChallenges.splice(index, 1);
|
||||
|
||||
}
|
||||
|
||||
pairedWith.completedChallenges.push({
|
||||
_id: challengeId,
|
||||
name: challengeName,
|
||||
completedWith: req.user._id,
|
||||
completedDate: isCompletedDate,
|
||||
solution: isSolution,
|
||||
challengeType: 5
|
||||
});
|
||||
|
||||
req.user.completedChallenges.push({
|
||||
_id: challengeId,
|
||||
name: challengeName,
|
||||
completedWith: pairedWith._id,
|
||||
completedDate: isCompletedDate,
|
||||
solution: isSolution,
|
||||
challengeType: 5
|
||||
});
|
||||
|
||||
req.user.save(function (err, user) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
pairedWith.save(function (err, paired) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
if (user && paired) {
|
||||
res.send(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
req.user.completedChallenges.push({
|
||||
_id: challengeId,
|
||||
name: challengeName,
|
||||
completedWith: null,
|
||||
completedDate: isCompletedDate,
|
||||
solution: isSolution,
|
||||
challengeType: 5
|
||||
});
|
||||
|
||||
var index = req.user.uncompletedChallenges.indexOf(challengeId);
|
||||
debug('this is the challengeId we got', challengeId);
|
||||
debug('This is the index of the search for bonfire', index);
|
||||
if (index > -1) {
|
||||
|
||||
req.user.progressTimestamps.push(Date.now() || 0);
|
||||
req.user.uncompletedChallenges.splice(index, 1);
|
||||
}
|
||||
|
||||
req.user.save(function (err, user) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
if (user) {
|
||||
res.send(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.completedChallenge = function (req, res, next) {
|
||||
@ -274,7 +393,6 @@ exports.completedChallenge = function (req, res, next) {
|
||||
var isCompletedDate = Math.round(+new Date());
|
||||
var challengeId = req.body.challengeInfo.challengeId;
|
||||
|
||||
|
||||
req.user.completedChallenges.push({
|
||||
_id: challengeId,
|
||||
completedDate: isCompletedDate,
|
||||
@ -302,12 +420,12 @@ exports.completedChallenge = function (req, res, next) {
|
||||
|
||||
exports.completedZiplineOrBasejump = function (req, res, next) {
|
||||
|
||||
var isCompletedWith = req.body.coursewareInfo.completedWith || false;
|
||||
var isCompletedWith = req.body.challengeInfo.completedWith || false;
|
||||
var isCompletedDate = Math.round(+new Date());
|
||||
var coursewareHash = req.body.coursewareInfo.coursewareHash;
|
||||
var solutionLink = req.body.coursewareInfo.publicURL;
|
||||
var githubLink = req.body.coursewareInfo.challengeType === '4'
|
||||
? req.body.coursewareInfo.githubURL : true;
|
||||
var challengeId = req.body.challengeInfo.challengeId;
|
||||
var solutionLink = req.body.challengeInfo.publicURL;
|
||||
var githubLink = req.body.challengeInfo.challengeType === '4'
|
||||
? req.body.challengeInfo.githubURL : true;
|
||||
if (!solutionLink || !githubLink) {
|
||||
req.flash('errors', {
|
||||
msg: 'You haven\'t supplied the necessary URLs for us to inspect ' +
|
||||
@ -322,16 +440,16 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
} else {
|
||||
var index = req.user.uncompletedCoursewares.indexOf(coursewareHash);
|
||||
var index = req.user.uncompletedChallenges.indexOf(challengeId);
|
||||
if (index > -1) {
|
||||
req.user.progressTimestamps.push(Date.now() || 0);
|
||||
req.user.uncompletedCoursewares.splice(index, 1);
|
||||
req.user.uncompletedChallenges.splice(index, 1);
|
||||
}
|
||||
var pairedWith = pairedWithFromMongo.pop();
|
||||
|
||||
req.user.completedCoursewares.push({
|
||||
_id: coursewareHash,
|
||||
name: req.body.coursewareInfo.coursewareName,
|
||||
req.user.completedChallenges.push({
|
||||
_id: challengeId,
|
||||
name: req.body.challengeInfo.coursewareName,
|
||||
completedWith: pairedWith._id,
|
||||
completedDate: isCompletedDate,
|
||||
solution: solutionLink,
|
||||
@ -347,16 +465,16 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
|
||||
if (req.user._id.toString() === pairedWith._id.toString()) {
|
||||
return res.sendStatus(200);
|
||||
}
|
||||
index = pairedWith.uncompletedCoursewares.indexOf(coursewareHash);
|
||||
index = pairedWith.uncompletedChallenges.indexOf(challengeId);
|
||||
if (index > -1) {
|
||||
pairedWith.progressTimestamps.push(Date.now() || 0);
|
||||
pairedWith.uncompletedCoursewares.splice(index, 1);
|
||||
pairedWith.uncompletedChallenges.splice(index, 1);
|
||||
|
||||
}
|
||||
|
||||
pairedWith.completedCoursewares.push({
|
||||
_id: coursewareHash,
|
||||
name: req.body.coursewareInfo.coursewareName,
|
||||
pairedWith.completedChallenges.push({
|
||||
_id: challengeId,
|
||||
name: req.body.challengeInfo.coursewareName,
|
||||
completedWith: req.user._id,
|
||||
completedDate: isCompletedDate,
|
||||
solution: solutionLink,
|
||||
@ -376,9 +494,9 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
|
||||
});
|
||||
} else {
|
||||
|
||||
req.user.completedCoursewares.push({
|
||||
_id: coursewareHash,
|
||||
name: req.body.coursewareInfo.coursewareName,
|
||||
req.user.completedChallenges.push({
|
||||
_id: challengeId,
|
||||
name: req.body.challengeInfo.challengeName,
|
||||
completedWith: null,
|
||||
completedDate: isCompletedDate,
|
||||
solution: solutionLink,
|
||||
@ -386,10 +504,10 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
|
||||
verified: false
|
||||
});
|
||||
|
||||
var index = req.user.uncompletedCoursewares.indexOf(coursewareHash);
|
||||
var index = req.user.uncompletedChallenges.indexOf(challengeId);
|
||||
if (index > -1) {
|
||||
req.user.progressTimestamps.push(Date.now() || 0);
|
||||
req.user.uncompletedCoursewares.splice(index, 1);
|
||||
req.user.uncompletedChallenges.splice(index, 1);
|
||||
}
|
||||
|
||||
req.user.save(function (err, user) {
|
||||
@ -402,23 +520,3 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
challengeBlock {
|
||||
0: {
|
||||
"name": "basic_html",
|
||||
"challenges: []
|
||||
},
|
||||
1: {
|
||||
"name": "basic_css",
|
||||
"challenges": [],
|
||||
}
|
||||
}
|
||||
|
||||
currentChallenge{
|
||||
"challengeBlock": number,
|
||||
"challengeId": _id,
|
||||
"challengeName": string
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -27,33 +27,15 @@ var challengeTypes = {
|
||||
|
||||
module.exports = {
|
||||
challengeMap: function challengeMap(req, res) {
|
||||
var completedBonfires = [];
|
||||
var completedList = [];
|
||||
|
||||
if (req.user) {
|
||||
completedBonfires = req.user.completedChallenges
|
||||
.filter(function (elem) {
|
||||
return elem.challengeType === challengeTypes.BONFIRE;
|
||||
})
|
||||
.map(function(elem) {
|
||||
return elem._id;
|
||||
});
|
||||
completedList = req.user.completedChallenges;
|
||||
}
|
||||
|
||||
if (req.user) {
|
||||
completedList = req.user.completedChallenges
|
||||
.filter(function (elem) {
|
||||
return elem.challengeType !== challengeTypes.BONFIRE;
|
||||
});
|
||||
}
|
||||
|
||||
var noDuplicateBonfires = R.uniq(completedBonfires);
|
||||
var noDuplicatedChallenges = R.uniq(completedList);
|
||||
|
||||
var completedBonfireList = noDuplicateBonfires
|
||||
.map(function(bonfire) {
|
||||
return bonfire._id;
|
||||
});
|
||||
|
||||
var challengeList = resources.allChallenges();
|
||||
var completedChallengeList = noDuplicatedChallenges
|
||||
.map(function(challenge) {
|
||||
@ -120,7 +102,6 @@ module.exports = {
|
||||
debug('User err: ', err);
|
||||
return next(err);
|
||||
}
|
||||
debug('Data for render is: ', completedBonfireList, completedChallengeList);
|
||||
res.render('challengeMap/show', {
|
||||
daysRunning: daysRunning,
|
||||
camperCount: numberWithCommas(camperCount),
|
||||
@ -129,7 +110,6 @@ module.exports = {
|
||||
waypoints: waypoints,
|
||||
ziplines: ziplines,
|
||||
basejumps: basejumps,
|
||||
completedBonfireList: completedBonfireList,
|
||||
completedChallengeList: completedChallengeList
|
||||
});
|
||||
});
|
||||
|
@ -373,7 +373,9 @@ exports.returnUser = function(req, res, next) {
|
||||
website3Title: user.portfolio.website3Title,
|
||||
website3Image: user.portfolio.website3Image,
|
||||
challenges: challenges,
|
||||
bonfires: user.completedBonfires,
|
||||
bonfires: user.completedChallenges.filter(function(challenge) {
|
||||
return challenge.challengeType === 5;
|
||||
}),
|
||||
calender: data,
|
||||
moment: moment,
|
||||
longestStreak: user.longestStreak + (user.longestStreak === 1 ? " day" : " days"),
|
||||
|
@ -124,7 +124,10 @@ var userSchema = new mongoose.Schema({
|
||||
uncompletedCoursewares: Array,
|
||||
completedCoursewares: [
|
||||
{
|
||||
completedDate: Long,
|
||||
completedDate: {
|
||||
type: Long,
|
||||
default: Date.now()
|
||||
},
|
||||
_id: String,
|
||||
name: String,
|
||||
completedWith: String,
|
||||
@ -159,7 +162,11 @@ var userSchema = new mongoose.Schema({
|
||||
completedWith: String,
|
||||
solution: String,
|
||||
githubLink: String,
|
||||
verified: Boolean
|
||||
verified: Boolean,
|
||||
challengeType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
}
|
||||
],
|
||||
uncompletedChallenges: Array
|
||||
|
@ -64,18 +64,19 @@ var after = editor.charCoords({line: editor.getCursor().line + 1, ch: 0}, "local
|
||||
if (info.top + info.clientHeight < after)
|
||||
editor.scrollTo(null, after - info.clientHeight + 3);
|
||||
|
||||
|
||||
var editorValue;
|
||||
|
||||
|
||||
var challengeSeed = challengeSeed || null;
|
||||
var tests = tests || [];
|
||||
|
||||
|
||||
if (challengeSeed !== null) {
|
||||
editorValue = challengeSeed;
|
||||
} else {
|
||||
editorValue = nonChallengeValue;
|
||||
}
|
||||
var allSeeds = '';
|
||||
(function() {
|
||||
challengeSeed.forEach(function(elem) {
|
||||
allSeeds += elem + '\n';
|
||||
});
|
||||
})();
|
||||
|
||||
|
||||
myCodeMirror.setValue(editorValue);
|
||||
|
@ -139,7 +139,7 @@ function doLinting () {
|
||||
//$('#testSuite').empty();
|
||||
function showCompletion() {
|
||||
var time = Math.floor(Date.now()) - started;
|
||||
ga('send', 'event', 'Challenge', 'solved', challengeName + ', Time: ' + time);
|
||||
ga('send', 'event', 'Challenge', 'solved', challenge_Name + ', Time: ' + time);
|
||||
$('#next-courseware-button').removeAttr('disabled');
|
||||
$('#next-courseware-button').addClass('animated tada');
|
||||
if (!userLoggedIn) {
|
||||
|
@ -112,7 +112,7 @@ $('#submitButton').on('click', function () {
|
||||
|
||||
function bonfireExecute() {
|
||||
attempts++;
|
||||
ga('send', 'event', 'Challenge', 'ran-code', challengeName);
|
||||
ga('send', 'event', 'Challenge', 'ran-code', challenge_Name);
|
||||
userTests= null;
|
||||
$('#codeOutput').empty();
|
||||
var userJavaScript = myCodeMirror.getValue();
|
||||
@ -193,6 +193,8 @@ var createTestDisplay = function() {
|
||||
};
|
||||
|
||||
var expect = chai.expect;
|
||||
var assert = chai.assert;
|
||||
var should = chai.should;
|
||||
|
||||
|
||||
var reassembleTest = function(test, data) {
|
||||
@ -236,7 +238,7 @@ var runTests = function(err, data) {
|
||||
|
||||
function showCompletion() {
|
||||
var time = Math.floor(Date.now()) - started;
|
||||
ga('send', 'event', 'Challenge', 'solved', challengeName + ', Time: ' + time +', Attempts: ' + attempts);
|
||||
ga('send', 'event', 'Challenge', 'solved', challenge_Name + ', Time: ' + time +', Attempts: ' + attempts);
|
||||
$('#complete-courseware-dialog').modal('show');
|
||||
$('#complete-courseware-dialog').keydown(function(e) {
|
||||
if (e.ctrlKey && e.keyCode == 13) {
|
@ -47,28 +47,6 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
function completedBonfire(didCompleteWith, bonfireSolution, thisBonfireHash, bonfireName) {
|
||||
$('#complete-bonfire-dialog').modal('show');
|
||||
// Only post to server if there is an authenticated user
|
||||
if ($('.signup-btn-nav').length < 1) {
|
||||
$.post(
|
||||
'/completed-bonfire',
|
||||
{
|
||||
bonfireInfo: {
|
||||
completedWith: didCompleteWith,
|
||||
solution: bonfireSolution,
|
||||
bonfireHash: thisBonfireHash,
|
||||
bonfireName: bonfireName
|
||||
}
|
||||
},
|
||||
function(res) {
|
||||
if (res) {
|
||||
window.location.href = '/bonfires'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function completedFieldGuide(fieldGuideId) {
|
||||
if ($('.signup-btn-nav').length < 1) {
|
||||
$.post(
|
||||
@ -86,15 +64,6 @@ $(document).ready(function() {
|
||||
}
|
||||
}
|
||||
|
||||
$('.next-bonfire-button').on('click', function() {
|
||||
var bonfireSolution = myCodeMirror.getValue();
|
||||
var thisBonfireHash = passedBonfireHash || null;
|
||||
var bonfireName = $('#bonfire-name').text();
|
||||
var didCompleteWith = $('#completed-with').val() || null;
|
||||
completedBonfire(didCompleteWith, bonfireSolution, thisBonfireHash, bonfireName);
|
||||
|
||||
});
|
||||
|
||||
$('.next-field-guide-button').on('click', function() {
|
||||
var fieldGuideId = $('#fieldGuideId').text();
|
||||
completedFieldGuide(fieldGuideId);
|
||||
@ -112,26 +81,30 @@ $(document).ready(function() {
|
||||
$('#complete-zipline-or-basejump-dialog').modal('show');
|
||||
});
|
||||
|
||||
$('#complete-bonfire-dialog').on('hidden.bs.modal', function() {
|
||||
editor.focus();
|
||||
});
|
||||
|
||||
$('#complete-courseware-dialog').on('hidden.bs.modal', function() {
|
||||
editor.focus();
|
||||
});
|
||||
|
||||
var challengeTypes = {
|
||||
'HTML_CSS_JQ': 0,
|
||||
'JAVASCRIPT': 1,
|
||||
'VIDEO': 2,
|
||||
'ZIPLINE': 3,
|
||||
'BASEJUMP': 4,
|
||||
'BONFIRE': 5
|
||||
};
|
||||
$('#next-courseware-button').on('click', function() {
|
||||
if ($('.signup-btn-nav').length < 1) {
|
||||
switch (challengeType) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case challengeTypes.HTML_CSS_JQ:
|
||||
case challengeTypes.JAVASCRIPT:
|
||||
case challengeTypes.VIDEO:
|
||||
console.log(challenge_Id);
|
||||
$.post(
|
||||
'/completed-challenge/',
|
||||
{
|
||||
challengeInfo: {
|
||||
challengeId: challengeId,
|
||||
challengeName: challengeName
|
||||
challengeId: challenge_Id,
|
||||
challengeName: challenge_Name
|
||||
}
|
||||
}).success(
|
||||
function(res) {
|
||||
@ -141,15 +114,15 @@ $(document).ready(function() {
|
||||
}
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
case challengeTypes.ZIPLINE:
|
||||
var didCompleteWith = $('#completed-with').val() || null;
|
||||
var publicURL = $('#public-url').val() || null;
|
||||
$.post(
|
||||
'/completed-zipline-or-basejump/',
|
||||
{
|
||||
challengeInfo: {
|
||||
challengeId: challengeId,
|
||||
challengeName: challengeName,
|
||||
challengeId: challenge_Id,
|
||||
challengeName: challenge_Name,
|
||||
completedWith: didCompleteWith,
|
||||
publicURL: publicURL,
|
||||
challengeType: challengeType
|
||||
@ -162,7 +135,7 @@ $(document).ready(function() {
|
||||
window.location.href = '/challenges';
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
case challengeTypes.BASEJUMP:
|
||||
var didCompleteWith = $('#completed-with').val() || null;
|
||||
var publicURL = $('#public-url').val() || null;
|
||||
var githubURL = $('#github-url').val() || null;
|
||||
@ -170,8 +143,8 @@ $(document).ready(function() {
|
||||
'/completed-zipline-or-basejump/',
|
||||
{
|
||||
challengeInfo: {
|
||||
challengeId: challengeId,
|
||||
challengeName: challengeName,
|
||||
challengeId: challenge_Id,
|
||||
challengeName: challenge_Name,
|
||||
completedWith: didCompleteWith,
|
||||
publicURL: publicURL,
|
||||
githubURL: githubURL,
|
||||
@ -184,6 +157,26 @@ $(document).ready(function() {
|
||||
window.location.replace(window.location.href);
|
||||
});
|
||||
break;
|
||||
case challengeTypes.BONFIRE:
|
||||
var bonfireSolution = myCodeMirror.getValue();
|
||||
var didCompleteWith = $('#completed-with').val() || null;
|
||||
$.post(
|
||||
'/completed-bonfire/',
|
||||
{
|
||||
challengeInfo: {
|
||||
challengeId: challenge_Id,
|
||||
challengeName: challenge_Name,
|
||||
completedWith: didCompleteWith,
|
||||
challengeType: challengeType,
|
||||
solution: bonfireSolution
|
||||
}
|
||||
},
|
||||
function(res) {
|
||||
if (res) {
|
||||
window.location.href = '/challenges/next-challenge';
|
||||
}
|
||||
}
|
||||
);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ block content
|
||||
for bonfire in bonfires
|
||||
tr
|
||||
td.col-xs-4
|
||||
a(href='/bonfires/' + bonfire.name)= bonfire.name
|
||||
a(href='/challenges/' + bonfire.name)= bonfire.name
|
||||
td.col-xs-2= moment(bonfire.completedDate, 'x').format("MMM DD, YYYY")
|
||||
td.col-xs-6
|
||||
pre.wrappable= bonfire.solution
|
||||
|
@ -93,9 +93,10 @@ block content
|
||||
script(type="text/javascript").
|
||||
var tests = !{JSON.stringify(tests)};
|
||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
var passedBonfireHash = !{JSON.stringify(bonfireHash)};
|
||||
var challengeName = !{JSON.stringify(name)};
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var started = Math.floor(Date.now());
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var _ = R;
|
||||
var dashed = !{JSON.stringify(dashedName)};
|
||||
|
||||
@ -104,11 +105,11 @@ block content
|
||||
form.code
|
||||
.form-group.codeMirrorView
|
||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||
script(src='/js/lib/bonfire/bonfireFramework_v0.1.3.js')
|
||||
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.2.js')
|
||||
|
||||
|
||||
|
||||
#complete-bonfire-dialog.modal(tabindex='-1')
|
||||
#complete-courseware-dialog.modal(tabindex='-1')
|
||||
.modal-dialog.animated.zoomIn.fast-animation
|
||||
.modal-content
|
||||
.modal-header.challenge-list-header= compliment
|
||||
@ -129,11 +130,11 @@ block content
|
||||
span.ion-close-circled
|
||||
| Username not found
|
||||
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block.next-bonfire-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid && existingUser.length > 0') Go to my next bonfire (ctrl + enter)
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid && existingUser.length > 0') Go to my next bonfire (ctrl + enter)
|
||||
|
||||
|
||||
- if (user.progressTimestamps.length > 2)
|
||||
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank", href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20Bonfire:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/bonfires/#{dashedName}&hashtags=LearnToCode, JavaScript")
|
||||
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank", href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20Bonfire:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript")
|
||||
i.fa.fa-twitter  
|
||||
= phrase
|
||||
- else
|
||||
|
@ -5,7 +5,6 @@ block content
|
||||
var waypointList = !{JSON.stringify(waypoints)};
|
||||
var ziplineList = !{JSON.stringify(ziplines)};
|
||||
var basejumpList = !{JSON.stringify(basejumps)};
|
||||
var completedBonfires = !{JSON.stringify(completedBonfireList)};
|
||||
var completedChallenges = !{JSON.stringify(completedChallengeList)};
|
||||
.panel.panel-info
|
||||
.panel-heading.text-center
|
||||
@ -52,19 +51,19 @@ block content
|
||||
h3.negative-15
|
||||
ol
|
||||
for bonfire in bonfires
|
||||
if completedBonfireList.indexOf(bonfire._id) > -1
|
||||
if completedChallengeList.indexOf(bonfire._id) > -1
|
||||
.row
|
||||
.hidden-xs.col-sm-3.col-md-2.text-primary.ion-checkmark-circled.padded-ionic-icon.text-center
|
||||
.col-xs-12.col-sm-9.col-md-10
|
||||
li.faded
|
||||
a(href="/bonfires/#{bonfire.name}")= bonfire.name
|
||||
a(href="/challenges/#{bonfire.name}")= bonfire.name
|
||||
else
|
||||
.row
|
||||
.hidden-xs.col-sm-3.col-md-2
|
||||
span
|
||||
.col-xs-12.col-sm-9.col-md-10
|
||||
li
|
||||
a(href="/bonfires/#{bonfire.name}")= bonfire.name
|
||||
a(href="/challenges/#{bonfire.name}")= bonfire.name
|
||||
h2
|
||||
span.fa.fa-angle-double-right
|
||||
| Ziplines (200 hours of front end development)
|
||||
|
@ -56,8 +56,8 @@ block content
|
||||
$('#next-courseware-button').attr('disabled', 'disabled');
|
||||
var tests = !{JSON.stringify(tests)};
|
||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
var challengeId = !{JSON.stringify(challengeId)};
|
||||
var challengeName = !{JSON.stringify(name)};
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var prodOrDev = !{JSON.stringify(environment)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var started = Math.floor(Date.now());
|
||||
|
@ -45,8 +45,8 @@ block content
|
||||
script(type="text/javascript").
|
||||
var tests = !{JSON.stringify(tests)};
|
||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
var challengeId = !{JSON.stringify(challengeId)};
|
||||
var challengeName = !{JSON.stringify(name)};
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var started = Math.floor(Date.now());
|
||||
|
||||
@ -55,7 +55,7 @@ block content
|
||||
form.code
|
||||
.form-group.codeMirrorView
|
||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.1.js')
|
||||
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.2.js')
|
||||
#complete-courseware-dialog.modal(tabindex='-1')
|
||||
.modal-dialog.animated.zoomIn.fast-animation
|
||||
.modal-content
|
||||
|
@ -28,11 +28,7 @@ block content
|
||||
br
|
||||
.button-spacer
|
||||
script(type="text/javascript").
|
||||
var tests = !{JSON.stringify(tests)};
|
||||
var challengeId = !{JSON.stringify(challengeId)};
|
||||
var challengeName = !{JSON.stringify(name)};
|
||||
var started = Math.floor(Date.now());
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
|
||||
var controlEnterHandler = function(e) {
|
||||
$('body').unbind('keypress');
|
||||
if (e.ctrlKey && e.keyCode == 13) {
|
||||
@ -75,3 +71,7 @@ block content
|
||||
h1 #{name}
|
||||
script.
|
||||
$('body').bind('keypress', controlEnterHandler);
|
||||
script.
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
@ -32,9 +32,8 @@ block content
|
||||
var userLoggedIn = false;
|
||||
br
|
||||
script(type="text/javascript").
|
||||
var passedCoursewareHash = !{JSON.stringify(coursewareHash)};
|
||||
var challengeName = !{JSON.stringify(name)};
|
||||
var passedCoursewareName = challengeName;
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var started = Math.floor(Date.now());
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var controlEnterHandler = function (e) {
|
||||
|
@ -31,7 +31,7 @@ script(src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js")
|
||||
script.
|
||||
window.moment || document.write('<script src="/bower_components/moment/min/moment.min.js"><\/script>');
|
||||
|
||||
// Leave alone below
|
||||
// Leave the below lines alone!
|
||||
script(src="/js/main.js")
|
||||
|
||||
script(src="/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js")
|
||||
@ -45,6 +45,7 @@ link(rel="stylesheet" type="text/css" href="/bower_components/cal-heatmap/cal-he
|
||||
link(rel='stylesheet', href='/bower_components/font-awesome/css/font-awesome.min.css')
|
||||
|
||||
link(rel='stylesheet', href='/css/main.css')
|
||||
// End **REQUIRED** includes
|
||||
|
||||
include meta
|
||||
title #{title} | Free Code Camp
|
||||
|
Reference in New Issue
Block a user