Merge branch 'staging' into feature/ctrl-enter-submit
Conflicts: server/views/coursewares/showBonfire.jade server/views/coursewares/showHTML.jade
This commit is contained in:
@ -216,6 +216,16 @@ var allSeeds = '';
|
||||
});
|
||||
})();
|
||||
|
||||
if (typeof emmetCodeMirror !== 'undefined') {
|
||||
var defaultKeymap = {
|
||||
'Cmd-E': 'emmet.expand_abbreviation',
|
||||
'Tab': 'emmet.expand_abbreviation_with_tab',
|
||||
'Enter': 'emmet.insert_formatted_line_break_only'
|
||||
};
|
||||
|
||||
emmetCodeMirror(editor, defaultKeymap);
|
||||
}
|
||||
|
||||
editor.setOption('extraKeys', {
|
||||
Tab: function(cm) {
|
||||
if (cm.somethingSelected()) {
|
||||
@ -401,9 +411,13 @@ var postError = function(data) {
|
||||
var goodTests = 0;
|
||||
var testSuccess = function() {
|
||||
goodTests++;
|
||||
// test successful run show completion
|
||||
if (goodTests === tests.length) {
|
||||
showCompletion();
|
||||
return showCompletion();
|
||||
}
|
||||
|
||||
// test unsuccessful, make sure initRun is set to false
|
||||
isInitRun = false;
|
||||
};
|
||||
|
||||
function showCompletion() {
|
||||
@ -465,7 +479,7 @@ function showCompletion() {
|
||||
},
|
||||
function(res) {
|
||||
if (res) {
|
||||
window.location = '/challenges/next-challenge';
|
||||
window.location = '/challenges/next-challenge?id=' + challenge_Id;
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -632,7 +646,9 @@ var runTests = function(err, data) {
|
||||
) {
|
||||
try {
|
||||
if (chaiTestFromJSON) {
|
||||
/* eslint-disable no-eval */
|
||||
var output = eval(reassembleTest(chaiTestFromJSON, data));
|
||||
/* eslint-enable no-eval */
|
||||
}
|
||||
} catch (error) {
|
||||
allTestsPassed = false;
|
||||
@ -647,8 +663,7 @@ var runTests = function(err, data) {
|
||||
if (allTestsPassed) {
|
||||
allTestsPassed = false;
|
||||
showCompletion();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
isInitRun = false;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ $(document).ready(function() {
|
||||
}).success(
|
||||
function(res) {
|
||||
if (res) {
|
||||
window.location.href = '/challenges/next-challenge';
|
||||
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||
}
|
||||
}).fail(
|
||||
function() {
|
||||
@ -164,7 +164,7 @@ $(document).ready(function() {
|
||||
}
|
||||
}).success(
|
||||
function() {
|
||||
window.location.href = '/challenges/next-challenge';
|
||||
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||
}).fail(
|
||||
function() {
|
||||
window.location.href = '/challenges';
|
||||
@ -187,13 +187,13 @@ $(document).ready(function() {
|
||||
verified: false
|
||||
}
|
||||
}).success(function() {
|
||||
window.location.href = '/challenges/next-challenge';
|
||||
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||
}).fail(function() {
|
||||
window.location.replace(window.location.href);
|
||||
});
|
||||
break;
|
||||
case challengeTypes.BONFIRE:
|
||||
window.location.href = '/challenges/next-challenge';
|
||||
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
// MDN Links
|
||||
/**
|
||||
* MDN Links
|
||||
*
|
||||
* These links are for Bonfires. Each key/value pair is used to render a Bonfire with appropriate links.
|
||||
* The text of the key is what the link text will be, e.g. <a href="https://developer ...">Global Array Object</a>
|
||||
* General convention is to use the page title of the MDN reference page.
|
||||
*
|
||||
**/
|
||||
|
||||
/* These links are for Bonfires. Each key/value pair is used to render a Bonfire with appropriate links.
|
||||
|
||||
|
||||
The text of the key is what the link text will be, e.g. <a href="https://developer ...">Global Array Object</a>
|
||||
General convention is to use the page title of the MDN reference page.
|
||||
*/
|
||||
var links =
|
||||
{
|
||||
var links = {
|
||||
// ========= NON MDN REFS
|
||||
"Currying": "https://leanpub.com/javascript-allonge/read#pabc",
|
||||
"Smallest Common Multiple": "https://www.mathsisfun.com/least-common-multiple.html",
|
||||
@ -57,6 +57,7 @@ var links =
|
||||
"String.toLowerCase()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase",
|
||||
"String.toString()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toString",
|
||||
"String.toUpperCase()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase",
|
||||
|
||||
// ======== ARRAY METHODS
|
||||
"Array.concat()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat",
|
||||
"Array.every()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every",
|
||||
|
@ -136,17 +136,18 @@
|
||||
"Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"tests": [
|
||||
"expect(palindrome(\"eye\")).to.be.a(\"boolean\");",
|
||||
"assert.deepEqual(palindrome(\"eye\"), true);",
|
||||
"assert.deepEqual(palindrome(\"race car\"), true);",
|
||||
"assert.deepEqual(palindrome(\"not a palindrome\"), false);",
|
||||
"assert.deepEqual(palindrome(\"A man, a plan, a canal. Panama\"), true);",
|
||||
"assert.deepEqual(palindrome(\"never odd or even\"), true);",
|
||||
"assert.deepEqual(palindrome(\"nope\"), false);",
|
||||
"assert.deepEqual(palindrome(\"almostomla\"), false);",
|
||||
"assert.deepEqual(palindrome(\"My age is 0, 0 si ega ym.\"), true);",
|
||||
"assert.deepEqual(palindrome(\"I'm 23 non 32 m'I?\"), true);",
|
||||
"assert.deepEqual(palindrome(\"1 eye for of 1 eye.\"), false);"
|
||||
"assert.isBoolean(palindrome(\"\"), \"palindrome() function returns a Boolean value\");",
|
||||
"assert.strictEqual(palindrome(\"eye\"), true, \"\\\"eye\\\" is a palindrome\");",
|
||||
"assert.strictEqual(palindrome(\"Race Car\"), true, \"\\\"Race Car\\\" is a palindrome\");",
|
||||
"assert.strictEqual(palindrome(\"not a palindrome\"), false, \"\\\"not a palindrome\\\" is not a palindrome\");",
|
||||
"assert.strictEqual(palindrome(\"A man, a plan, a canal. Panama\"), true, \"\\\"A man, a plan, a canal. Panama\\\" is a palindrome\");",
|
||||
"assert.strictEqual(palindrome(\"Never odd OR even\"), true, \"\\\"Never odd OR even\\\" is a palindrome\");",
|
||||
"assert.strictEqual(palindrome(\"Nope\"), false, \"\\\"Nope\\\" is not a palindrome\");",
|
||||
"assert.strictEqual(palindrome(\"almostomla\"), false, \"\\\"almostomla\\\" is not a palindrome\");",
|
||||
"assert.strictEqual(palindrome(\"My age is 0, 0 si ega ym.\"), true, \"\\\"My age is 0, 0 si ega ym.\\\" is a palindrome\");",
|
||||
"assert.strictEqual(palindrome(\"I'm 23 non 32 m'I?\"), true, \"\\\"I'm 23 non 32 m'I?\\\" is a palindrome\");",
|
||||
"assert.strictEqual(palindrome(\"1 eye for of 1 eye.\"), false, \"\\\"1 eye for of 1 eye.\\\" is not a palindrome\");",
|
||||
"assert.strictEqual(palindrome(\"0_0 (: /-\\ :) 0-0\"), true, \"\\\"0_0 (: /-\\\\ :) 0-0\\\" is a palindrome\");"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function palindrome(str) {",
|
||||
|
@ -1722,7 +1722,7 @@
|
||||
"Create two <code>div</code> elements within your row, both with the class <code>col-xs-6</code>."
|
||||
],
|
||||
"tests": [
|
||||
"assert($(\"div.row\").children(\"div.col-xs-6\").length > 1, 'Nest two <code>div class=\"col-xs-6\"</code> elements within your <code>div class=\"row\"</code> element.')",
|
||||
"assert($(\"div.row > div.col-xs-6\").length > 1, 'Nest two <code>div class=\"col-xs-6\"</code> elements within your <code>div class=\"row\"</code> element.')",
|
||||
"assert(editor.match(/<\\/div>/g) && editor.match(/<div/g) && editor.match(/<\\/div>/g).length === editor.match(/<div/g).length, 'Make sure all your <code>div</code> elements have closing tags.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
@ -1756,8 +1756,8 @@
|
||||
"Nest one <code>div</code> element with the class <code>well</code> within each of your <code>col-xs-6</code> <code>div</code> elements."
|
||||
],
|
||||
"tests": [
|
||||
"assert($(\"div\").length > 4, 'Add a <code>div</code> element with the class <code>well</code> inside each of your <code>div class=\"col-xs-6\" elements</code>')",
|
||||
"assert($(\"div.col-xs-6 div.well\").length > 1, 'Nest both of your <code>div class=\"col-xs-6\"</code> elements within your <code>div class=\"row\"</code> element.')",
|
||||
"assert($(\"div.col-xs-6\").not(\":has(>div.well)\").length < 1, 'Add a <code>div</code> element with the class <code>well</code> inside each of your <code>div class=\"col-xs-6\" elements</code>')",
|
||||
"assert($(\"div.row > div.col-xs-6\").length > 1, 'Nest both of your <code>div class=\"col-xs-6\"</code> elements within your <code>div class=\"row\"</code> element.')",
|
||||
"assert(editor.match(/<\\/div>/g) && editor.match(/<div/g) && editor.match(/<\\/div>/g).length === editor.match(/<div/g).length, 'Make sure all your <code>div</code> elements have closing tags.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
@ -16,8 +16,8 @@
|
||||
"tests": [
|
||||
"assert(editor.match(/<script>/g), 'Create a <code>script</code> element.')",
|
||||
"assert(editor.match(/<\\/script>/g) && editor.match(/<script/g) && editor.match(/<\\/script>/g).length === editor.match(/<script/g).length, 'Make sure your <code>script</code> element has a closing tag.')",
|
||||
"assert(editor.match(/\\$\\s*?\\(\\s*?document\\)\\.ready\\s*?\\(\\s*?function\\s*?\\(\\s*?\\)\\s*?\\{/g), 'Add <code>$(document).ready(function() {</code> to the beginning of your <code>script</code> element.')",
|
||||
"assert(editor.match(/\\n*?\\s*?\\}\\s*?\\);/g), 'Close your <code>$(document).ready(function() {</code> function with <code>});</code>.')"
|
||||
"assert(editor.match(/\\$\\s*?\\(\\s*?document\\)\\.ready\\s*?\\(\\s*?function\\s*?\\(\\s*?\\)\\s*?\\{/g), 'You should add <code>$(document).ready(function() {</code> to the beginning of your <code>script</code> element.')",
|
||||
"assert(editor.match(/\\n*?\\s*?\\}\\s*?\\);/g), 'Close your <code>$(document).ready(function() {</code> function with <code>});</code>.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"",
|
||||
|
@ -20,9 +20,9 @@
|
||||
"Give your <code>motorBike</code> object a <code>wheels</code>, <code>engines</code> and <code>seats</code> attribute and set them to numbers."
|
||||
],
|
||||
"tests":[
|
||||
"assert(typeof(motorBike.engines) === 'number', '<code>engines</code> should be have a <code>engines</code> attribute set to a number.');",
|
||||
"assert(typeof(motorBike.wheels) === 'number', '<code>wheels</code> should be have a <code>engines</code> attribute set to a number.');",
|
||||
"assert(typeof(motorBike.seats) === 'number', '<code>seats</code> should be have a <code>engines</code> attribute set to a number.');"
|
||||
"assert(typeof(motorBike.engines) === 'number', '<code>motorBike</code> should have a <code>engines</code> attribute set to a number.');",
|
||||
"assert(typeof(motorBike.wheels) === 'number', '<code>motorBike</code> should have a <code>wheels</code> attribute set to a number.');",
|
||||
"assert(typeof(motorBike.seats) === 'number', '<code>motorBike</code> should have a <code>seats</code> attribute set to a number.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"//Here is a sample Object",
|
||||
@ -54,12 +54,12 @@
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"We are also able to create objects using <code>constructor</code> functions.",
|
||||
"Give your <code>motorBike</code> object a <code>wheels</code>, <code>engines</code> and <code>seats</code> attribute and set them to numbers."
|
||||
"Give your <code>myMotorBike</code> object a <code>wheels</code>, <code>engines</code> and <code>seats</code> attribute and set them to numbers."
|
||||
],
|
||||
"tests":[
|
||||
"assert(typeof((new MotorBike()).engines) === 'number', '<code>engines</code> should be have a <code>engines</code> attribute set to a number.');",
|
||||
"assert(typeof((new MotorBike()).wheels) === 'number', '<code>wheels</code> should be have a <code>engines</code> attribute set to a number.');",
|
||||
"assert(typeof((new MotorBike()).seats) === 'number', '<code>seats</code> should be have a <code>engines</code> attribute set to a number.');"
|
||||
"assert(typeof((new MotorBike()).engines) === 'number', '<code>myMotorBike</code> should have a <code>engines</code> attribute set to a number.');",
|
||||
"assert(typeof((new MotorBike()).wheels) === 'number', '<code>myMotorBike</code> should have a <code>wheels</code> attribute set to a number.');",
|
||||
"assert(typeof((new MotorBike()).seats) === 'number', '<code>myMotorBike</code> should have a <code>seats</code> attribute set to a number.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"// Let's add the properties engines and seats to the car in the same way that the property wheels has been added below. They should both be numbers.",
|
||||
|
@ -14,7 +14,6 @@ import {
|
||||
|
||||
import {
|
||||
userMigration,
|
||||
ifNoUserRedirectTo,
|
||||
ifNoUserSend
|
||||
} from '../utils/middleware';
|
||||
|
||||
@ -100,9 +99,6 @@ module.exports = function(app) {
|
||||
const userCount$ = observeMethod(User, 'count');
|
||||
|
||||
const send200toNonUser = ifNoUserSend(true);
|
||||
const redirectNonUser = ifNoUserRedirectTo(
|
||||
'/challenges/learn-how-free-code-camp-works'
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/completed-challenge/',
|
||||
@ -125,26 +121,17 @@ module.exports = function(app) {
|
||||
router.get('/map', challengeMap);
|
||||
router.get(
|
||||
'/challenges/next-challenge',
|
||||
redirectNonUser,
|
||||
returnNextChallenge
|
||||
);
|
||||
|
||||
router.get('/challenges/:challengeName', returnIndividualChallenge);
|
||||
|
||||
router.get(
|
||||
'/challenges/',
|
||||
redirectNonUser,
|
||||
returnCurrentChallenge
|
||||
);
|
||||
|
||||
app.use(router);
|
||||
|
||||
function returnNextChallenge(req, res, next) {
|
||||
let nextChallengeName = firstChallenge;
|
||||
|
||||
const challengeId = req.user.currentChallenge ?
|
||||
req.user.currentChallenge.challengeId :
|
||||
'bd7123c8c441eddfaeb5bdef';
|
||||
const challengeId = req.query.id;
|
||||
|
||||
// find challenge
|
||||
return challenge$
|
||||
@ -199,16 +186,13 @@ module.exports = function(app) {
|
||||
nextChallengeName = nextChallenge.dashedName;
|
||||
return nextChallengeName;
|
||||
})
|
||||
.flatMap(() => {
|
||||
return saveUser(req.user);
|
||||
})
|
||||
.subscribe(
|
||||
function() {},
|
||||
next,
|
||||
function() {
|
||||
debug('next challengeName', nextChallengeName);
|
||||
if (!nextChallengeName || nextChallengeName === firstChallenge) {
|
||||
req.flash('errors', {
|
||||
req.flash('info', {
|
||||
msg: dedent`
|
||||
Once you have completed all of our challenges, you should
|
||||
join our <a href=\"//gitter.im/freecodecamp/HalfWayClub\"
|
||||
@ -223,34 +207,6 @@ module.exports = function(app) {
|
||||
);
|
||||
}
|
||||
|
||||
function returnCurrentChallenge(req, res, next) {
|
||||
Observable.just(req.user)
|
||||
.flatMap(user => {
|
||||
if (!req.user.currentChallenge) {
|
||||
return challenge$
|
||||
.first()
|
||||
.flatMap(challenge => {
|
||||
user.currentChallenge = {
|
||||
challengeId: challenge.id,
|
||||
challengeName: challenge.name,
|
||||
dashedName: challenge.dashedName
|
||||
};
|
||||
return saveUser(user);
|
||||
});
|
||||
}
|
||||
return Observable.just(user);
|
||||
})
|
||||
.map(user => user.currentChallenge.dashedName)
|
||||
.subscribe(
|
||||
function(challengeName) {
|
||||
res.redirect('/challenges/' + challengeName);
|
||||
},
|
||||
next,
|
||||
function() {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function returnIndividualChallenge(req, res, next) {
|
||||
const origChallengeName = req.params.challengeName;
|
||||
const unDashedName = unDasherize(origChallengeName);
|
||||
@ -285,18 +241,8 @@ module.exports = function(app) {
|
||||
return Observable.just('/challenges/' + dasherize(challenge.name));
|
||||
}
|
||||
|
||||
if (challenge) {
|
||||
if (req.user) {
|
||||
req.user.currentChallenge = {
|
||||
challengeId: challenge.id,
|
||||
challengeName: challenge.name,
|
||||
dashedName: challenge.dashedName
|
||||
};
|
||||
}
|
||||
|
||||
// save user does nothing if user does not exist
|
||||
return saveUser(req.user)
|
||||
.map(() => ({
|
||||
return Observable.just({
|
||||
title: challenge.name,
|
||||
dashedName: origChallengeName,
|
||||
name: challenge.name,
|
||||
@ -317,8 +263,7 @@ module.exports = function(app) {
|
||||
MDNlinks: getMDNLinks(challenge.MDNlinks),
|
||||
// htmls specific
|
||||
environment: utils.whichEnvironment()
|
||||
}));
|
||||
}
|
||||
});
|
||||
})
|
||||
.subscribe(
|
||||
function(data) {
|
||||
|
@ -114,6 +114,7 @@ block content
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var started = Math.floor(Date.now());
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
var _ = R;
|
||||
var dashed = !{JSON.stringify(dashedName)};
|
||||
|
||||
@ -140,14 +141,14 @@ block content
|
||||
.spacer
|
||||
.row
|
||||
if (user)
|
||||
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to next challenge (Ctrl + enter)
|
||||
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge (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%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript")
|
||||
i.fa.fa-twitter  
|
||||
= phrase
|
||||
else
|
||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||
#reset-modal.modal(tabindex='-1')
|
||||
.modal-dialog.animated.fadeInUp.fast-animation
|
||||
.modal-content
|
||||
|
@ -62,6 +62,7 @@ block content
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var prodOrDev = !{JSON.stringify(environment)};
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var started = Math.floor(Date.now());
|
||||
.col-xs-12.col-sm-12.col-md-5.col-lg-6
|
||||
@ -91,7 +92,7 @@ block content
|
||||
span.completion-icon.ion-checkmark-circled.text-primary
|
||||
.spacer
|
||||
if(user)
|
||||
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to next challenge (Ctrl + enter)
|
||||
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge (ctrl + enter)
|
||||
else
|
||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||
include ../partials/challenge-modals
|
||||
|
@ -61,6 +61,7 @@ block content
|
||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
var started = Math.floor(Date.now());
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var _ = R;
|
||||
@ -93,7 +94,7 @@ block content
|
||||
i.fa.fa-twitter  
|
||||
= phrase
|
||||
else
|
||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||
include ../partials/challenge-modals
|
||||
script.
|
||||
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||
|
@ -30,6 +30,8 @@ block content
|
||||
| Report a bug
|
||||
.button-spacer
|
||||
else
|
||||
a.animated.fadeIn.btn.btn-big.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge (ctrl + enter)
|
||||
.button-spacer
|
||||
a.btn.btn-big.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||
script.
|
||||
var userLoggedIn = false;
|
||||
@ -64,7 +66,7 @@ block content
|
||||
.animated.zoomInDown.delay-half
|
||||
span.completion-icon.ion-checkmark-circled.text-primary
|
||||
if (user)
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf) On to my next challenge (ctrl + enter)
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf) Go to my next challenge
|
||||
script.
|
||||
$('#complete-courseware-editorless-dialog').bind('keypress', modalControlEnterHandler);
|
||||
|
||||
@ -74,12 +76,12 @@ block content
|
||||
i.fa.fa-twitter  
|
||||
= phrase
|
||||
else
|
||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||
h1 #{name}
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||
script.
|
||||
$('body').bind('keypress', controlEnterHandler);
|
||||
script.
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
include ../partials/challenge-modals
|
||||
|
@ -33,7 +33,8 @@ block content
|
||||
script.
|
||||
var userLoggedIn = true;
|
||||
else
|
||||
a.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||
a.animated.fadeIn.btn.btn-big.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge (ctrl + enter)
|
||||
a.btn.btn-big.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||
script.
|
||||
var userLoggedIn = false;
|
||||
br
|
||||
@ -41,6 +42,7 @@ block content
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var started = Math.floor(Date.now());
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var controlEnterHandler = function (e) {
|
||||
$('body').unbind('keypress');
|
||||
@ -87,11 +89,12 @@ block content
|
||||
| Username not found
|
||||
|
||||
if (user)
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid') Go to my next challenge (ctrl + enter)
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid') Go to my next challenge
|
||||
.button-spacer
|
||||
script.
|
||||
$('#complete-zipline-or-basejump-dialog').on('keypress', modalControlEnterHandler);
|
||||
else
|
||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||
script.
|
||||
$('body').on('keypress', controlEnterHandler);
|
||||
include ../partials/challenge-modals
|
||||
|
@ -47,3 +47,7 @@
|
||||
h3 This will restore your code editor to its original state.
|
||||
a.btn.btn-lg.btn-info.btn-block#reset-button(href='#', data-dismiss='modal', aria-hidden='true') Clear my code
|
||||
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||
script.
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
localStorage.setItem('currentDashedName', dashedName);
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
|
||||
img.img-responsive.nav-logo(src='https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg', alt='learn to code javascript at Free Code Camp logo')
|
||||
.collapse.navbar-collapse
|
||||
ul.nav.navbar-nav.navbar-right.hamburger-dropdown
|
||||
li
|
||||
a.learn-btn(href='#') Learn
|
||||
li
|
||||
a(href='/map') Map
|
||||
li
|
||||
@ -32,3 +34,19 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
|
||||
.hidden-xs.hidden-sm
|
||||
a(href='/account')
|
||||
img.profile-picture.float-right(src='#{user.picture}')
|
||||
script.
|
||||
$(document).ready(function() {
|
||||
$('.learn-btn').click(function(e) {
|
||||
var challengeDashedName = null;
|
||||
e.preventDefault();
|
||||
if (typeof dashedName === "string") {
|
||||
return location.reload();
|
||||
}
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
challengeDashedName = localStorage.getItem('currentDashedName');
|
||||
}
|
||||
window.location = challengeDashedName ?
|
||||
'/challenges/' + challengeDashedName :
|
||||
'/map';
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user