More steps towards building the bonfire challenge interface
This commit is contained in:
8
app.js
8
app.js
@ -251,10 +251,10 @@ app.get(
|
|||||||
app.all('/account', passportConf.isAuthenticated);
|
app.all('/account', passportConf.isAuthenticated);
|
||||||
app.get('/account/api', userController.getAccountAngular);
|
app.get('/account/api', userController.getAccountAngular);
|
||||||
app.get('/bonfire', bonfireController.index);
|
app.get('/bonfire', bonfireController.index);
|
||||||
//app.get(
|
app.get(
|
||||||
// '/bonfire/:bonfireNumber',
|
'/bonfire/:bonfireNumber',
|
||||||
// bonfireController.returnBonfire
|
bonfireController.returnBonfire
|
||||||
//);
|
);
|
||||||
|
|
||||||
// Unique Check API route
|
// Unique Check API route
|
||||||
app.get('/api/checkUniqueUsername/:username', userController.checkUniqueUsername);
|
app.get('/api/checkUniqueUsername/:username', userController.checkUniqueUsername);
|
||||||
|
@ -48,29 +48,32 @@ exports.returnBonfire = function(req, res, next) {
|
|||||||
"Establish your alibi for the past two hours",
|
"Establish your alibi for the past two hours",
|
||||||
"Prove to mom that computers aren't just for games"
|
"Prove to mom that computers aren't just for games"
|
||||||
];
|
];
|
||||||
|
|
||||||
if (bonfireNumber > highestBonfireNumber) { bonfireNumber = 0; }
|
if (bonfireNumber > highestBonfireNumber) { bonfireNumber = 0; }
|
||||||
Bonfire.find({}, null, { sort: { bonfireNumber: 1 } }, function(err, c) {
|
Bonfire.find({}, null, { sort: { bonfireNumber: 1 } }, function(err, bonfire) {
|
||||||
if (err) {
|
if (err) {
|
||||||
debug('bonfire err: ', err);
|
debug('bonfire err: ', err);
|
||||||
next(err);
|
next(err);
|
||||||
}
|
}
|
||||||
|
res.render('bonfire/show', {
|
||||||
|
title: bonfire[bonfireNumber].name,
|
||||||
|
name: bonfire[bonfireNumber].name,
|
||||||
|
number: bonfire[bonfireNumber].bonfireNumber,
|
||||||
|
difficulty: bonfire[bonfireNumber].difficulty,
|
||||||
|
description: bonfire[bonfireNumber].description,
|
||||||
|
publicTests: bonfire[bonfireNumber].publicTests,
|
||||||
|
privateTests: bonfire[bonfireNumber].privateTests,
|
||||||
|
challengeSeed: bonfire[bonfireNumber].challengeSeed,
|
||||||
|
challengeEntryPoint: bonfire[bonfireNumber].challengeEntryPoint,
|
||||||
|
//title: bonfire.name,
|
||||||
|
//name: bonfire.name,
|
||||||
|
//description: bonfire.description,
|
||||||
|
|
||||||
res.render('bonfires/show', {
|
//cc: req.user ? req.user.bonfiresHash : undefined,
|
||||||
title: 'bonfire: ' + c[bonfireNumber].name,
|
//points: req.user ? req.user.points : undefined,
|
||||||
name: c[bonfireNumber].name,
|
//verb: verbs[Math.floor(Math.random() * verbs.length)],
|
||||||
number: bonfireNumber,
|
//phrase: phrases[Math.floor(Math.random() * phrases.length)],
|
||||||
difficulty: c[bonfireNumber].difficulty,
|
bonfires: bonfire
|
||||||
description: c[bonfireNumber].description,
|
|
||||||
publicTests: c[bonfireNumber].publicTests,
|
|
||||||
privateTests: c[bonfireNumber].privateTests,
|
|
||||||
challengeSeed: c[bonfireNumber].challengeSeed,
|
|
||||||
challengeEntryPoint: c[bonfireNumber].challengeEntryPoint,
|
|
||||||
|
|
||||||
cc: req.user ? req.user.bonfiresHash : undefined,
|
|
||||||
points: req.user ? req.user.points : undefined,
|
|
||||||
verb: verbs[Math.floor(Math.random() * verbs.length)],
|
|
||||||
phrase: phrases[Math.floor(Math.random() * phrases.length)],
|
|
||||||
bonfires: c
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
@ -6,9 +6,7 @@ var secrets = require('../config/secrets');
|
|||||||
* @type {exports.Schema}
|
* @type {exports.Schema}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//new Schema({ _id: String })
|
|
||||||
//var ObjectId = require('mongoose').Types.ObjectId;
|
|
||||||
//var myObjectId = ObjectId.fromString('myhexstring');
|
|
||||||
var bonfireSchema = new mongoose.Schema({
|
var bonfireSchema = new mongoose.Schema({
|
||||||
|
|
||||||
name: {
|
name: {
|
||||||
|
@ -22,6 +22,7 @@ Challenge.remove({}, function(err, data) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Bonfire.remove({}, function(err, data) {
|
Bonfire.remove({}, function(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
@ -12,7 +12,7 @@ block content
|
|||||||
link(rel='stylesheet', href='/js/lib/codemirror/theme/monokai.css')
|
link(rel='stylesheet', href='/js/lib/codemirror/theme/monokai.css')
|
||||||
link(rel="stylesheet", href="http://fonts.googleapis.com/css?family=Ubuntu+Mono")
|
link(rel="stylesheet", href="http://fonts.googleapis.com/css?family=Ubuntu+Mono")
|
||||||
script(src='/js/lib/codemirror/mode/javascript/javascript.js')
|
script(src='/js/lib/codemirror/mode/javascript/javascript.js')
|
||||||
script(src='js/lib/jailed/jailed.js')
|
script(src='/js/lib/jailed/jailed.js')
|
||||||
script(src='/js/lib/bonfire/bonfireInit.js')
|
script(src='/js/lib/bonfire/bonfireInit.js')
|
||||||
.row
|
.row
|
||||||
#mainEditorPanel.col-sm-12.col-md-7.col-xs-12
|
#mainEditorPanel.col-sm-12.col-md-7.col-xs-12
|
||||||
|
@ -1,39 +1,43 @@
|
|||||||
extends ../layout
|
extends ../layout
|
||||||
block content
|
block content
|
||||||
|
|
||||||
|
script(src='/js/lib/codemirror/lib/codemirror.js')
|
||||||
|
script(src='/js/lib/codemirror/addon/edit/closebrackets.js')
|
||||||
|
script(src='/js/lib/codemirror/addon/edit/matchbrackets.js')
|
||||||
|
script(src='/js/lib/codemirror/addon/lint/lint.js')
|
||||||
|
script(src='/js/lib/codemirror/addon/lint/javascript-lint.js')
|
||||||
|
script(src='//ajax.aspnetcdn.com/ajax/jshint/r07/jshint.js')
|
||||||
|
script(src='/js/lib/chai/chai.js')
|
||||||
|
link(rel='stylesheet', href='/js/lib/codemirror/lib/codemirror.css')
|
||||||
|
link(rel='stylesheet', href='/js/lib/codemirror/addon/lint/lint.css')
|
||||||
|
link(rel='stylesheet', href='/js/lib/codemirror/theme/monokai.css')
|
||||||
|
link(rel="stylesheet", href="http://fonts.googleapis.com/css?family=Ubuntu+Mono")
|
||||||
|
script(src='/js/lib/codemirror/mode/javascript/javascript.js')
|
||||||
|
script(src='/js/lib/jailed/jailed.js')
|
||||||
|
script(src='/js/lib/bonfire/bonfireInit.js')
|
||||||
.row
|
.row
|
||||||
.col-sm-12.col-md-12.col-xs-12
|
#mainEditorPanel.col-sm-12.col-md-7.col-xs-12
|
||||||
.panel.panel-primary
|
.panel.panel-primary.panel-bonfire
|
||||||
.panel-heading.text-center #{name} (Level #{difficulty} bonfire)
|
.panel-heading.text-center #{name} (Level #{difficulty} bonfire)
|
||||||
|
.panel.panel-body
|
||||||
|
form.code
|
||||||
|
h3 Details
|
||||||
|
h5
|
||||||
|
ol
|
||||||
|
for sentence in description
|
||||||
|
li!= sentence
|
||||||
|
.form-group.codeMirrorView
|
||||||
|
textarea#codeEditor(autofocus=true)
|
||||||
|
#testCreatePanel.col-sm-12.col-md-5.col-xs-12
|
||||||
|
.panel.panel-primary.panel-bonfire
|
||||||
|
.panel-heading.text-center Output
|
||||||
.panel.panel-body
|
.panel.panel-body
|
||||||
.col-xs-12.col-sm-10.col-sm-offset-1.col-md-8.col-md-offset-2
|
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
|
||||||
h3 Details
|
br
|
||||||
h4
|
form.code
|
||||||
ol
|
.form-group.codeMirrorView
|
||||||
for sentence in description
|
textarea#codeOutput
|
||||||
li!= sentence
|
br
|
||||||
.ten-pixel-break
|
ul#testSuite.list-group
|
||||||
.btn.btn-success.btn-big.btn-block.all-challenges Show me all the challenges
|
br
|
||||||
#complete-dialog.modal(tabindex='-1')
|
script(src='/js/lib/bonfire/bonfireFramework.js')
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
|
||||||
.modal-content
|
|
||||||
.modal-header.challenge-list-header Nicely done!
|
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
|
||||||
.modal-body
|
|
||||||
.text-center
|
|
||||||
.animated.zoomInDown.delay-half
|
|
||||||
span.landing-icon.ion-checkmark-circled.text-primary
|
|
||||||
- if (cc)
|
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block.next-button(name='_csrf', value=_csrf, aria-hidden='true') Take me to my next challenge
|
|
||||||
- if (points && points > 2)
|
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20Free%20Code%20Camp%20Challenge%20%23#{number}:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{number}&hashtags=learntocode, javascript" target="_blank")
|
|
||||||
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
|
|
||||||
#all-challenges-dialog.modal(tabindex='-1')
|
|
||||||
.modal-dialog.animated.fadeInUp.fast-animation
|
|
||||||
.modal-content
|
|
||||||
.modal-header.challenge-list-header Challenges
|
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
|
||||||
.modal-body
|
|
||||||
include ../partials/bonfires
|
|
@ -2,5 +2,44 @@ h3
|
|||||||
ol(start='0')
|
ol(start='0')
|
||||||
for bonfire in bonfires
|
for bonfire in bonfires
|
||||||
li
|
li
|
||||||
a(href="/bonfire/#{bonfire.bonfireNumber}", class="#{ (cc && cc[bonfire.bonfireNumber] > 0) ? 'strikethrough' : '' }") #{bonfire.name}
|
a(href="/bonfire/#{bonfire.bonfireNumber}") #{bonfire.name}
|
||||||
| (#{bonfire.time} mins)
|
| (Level #{bonfire.difficulty})
|
||||||
|
|
||||||
|
block content
|
||||||
|
script(src='/js/lib/codemirror/lib/codemirror.js')
|
||||||
|
script(src='/js/lib/codemirror/addon/edit/closebrackets.js')
|
||||||
|
script(src='/js/lib/codemirror/addon/edit/matchbrackets.js')
|
||||||
|
script(src='/js/lib/codemirror/addon/lint/lint.js')
|
||||||
|
script(src='/js/lib/codemirror/addon/lint/javascript-lint.js')
|
||||||
|
script(src='//ajax.aspnetcdn.com/ajax/jshint/r07/jshint.js')
|
||||||
|
script(src='/js/lib/chai/chai.js')
|
||||||
|
link(rel='stylesheet', href='/js/lib/codemirror/lib/codemirror.css')
|
||||||
|
link(rel='stylesheet', href='/js/lib/codemirror/addon/lint/lint.css')
|
||||||
|
link(rel='stylesheet', href='/js/lib/codemirror/theme/monokai.css')
|
||||||
|
link(rel="stylesheet", href="http://fonts.googleapis.com/css?family=Ubuntu+Mono")
|
||||||
|
script(src='/js/lib/codemirror/mode/javascript/javascript.js')
|
||||||
|
script(src='/js/lib/jailed/jailed.js')
|
||||||
|
script(src='/js/lib/bonfire/bonfireInit.js')
|
||||||
|
.row
|
||||||
|
#mainEditorPanel.col-sm-12.col-md-7.col-xs-12
|
||||||
|
.panel.panel-primary.panel-bonfire
|
||||||
|
.panel-heading.text-center Bonfire Playground
|
||||||
|
.panel.panel-body
|
||||||
|
form.code
|
||||||
|
.form-group.codeMirrorView
|
||||||
|
textarea#codeEditor(autofocus=true)
|
||||||
|
|
||||||
|
|
||||||
|
#testCreatePanel.col-sm-12.col-md-5.col-xs-12
|
||||||
|
.panel.panel-primary.panel-bonfire
|
||||||
|
.panel-heading.text-center Output
|
||||||
|
.panel.panel-body
|
||||||
|
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
|
||||||
|
br
|
||||||
|
form.code
|
||||||
|
.form-group.codeMirrorView
|
||||||
|
textarea#codeOutput
|
||||||
|
br
|
||||||
|
ul#testSuite.list-group
|
||||||
|
br
|
||||||
|
script(src='/js/lib/bonfire/bonfireFramework.js')
|
@ -2,5 +2,7 @@ h3
|
|||||||
ol(start='0')
|
ol(start='0')
|
||||||
for challenge in challenges
|
for challenge in challenges
|
||||||
li
|
li
|
||||||
a(href="/bonfire/#{bonfire.bonfireNumber}", class="#{ (cc && cc[bonfire.bonfireNumber] > 0) ? 'strikethrough' : '' }") #{bonfire.name}
|
a(href="/challenges/#{challenge.challengeNumber}", class="#{ (cc && cc[challenge.challengeNumber] > 0) ? 'strikethrough' : '' }") #{challenge.name}
|
||||||
| (Level #{bonfire.difficulty})
|
| (#{challenge.time} mins)
|
||||||
|
|
||||||
|
a.btn.btn-lg.btn-primary.btn-block(href="/done-with-first-100-hours", class="#{ ((cc && cc[53] === 0) || (!cc)) ? 'disabled' : '' }") I'm done with all the challenges!
|
Reference in New Issue
Block a user