Move bonfire view into courseware view folder. Update seed file to exit when finished.
This commit is contained in:
		| @@ -54,14 +54,7 @@ exports.returnNextChallenge = function(req, res, next) { | |||||||
|         return elem; |         return elem; | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|   // It's not important to wait for the save to finish as the updated user |  | ||||||
|   // object is already in memory! We'll just check to see if there was an |  | ||||||
|   // error saving and log it out to investigate in our logs. |  | ||||||
|   req.user.save(function(err, data) { |  | ||||||
|     if (err) { |  | ||||||
|       debug('%s saving user!', err); |  | ||||||
|     } |  | ||||||
|   }); |  | ||||||
|   // find the user's current challenge and block |   // find the user's current challenge and block | ||||||
|   // look in that block and find the index of their current challenge |   // look in that block and find the index of their current challenge | ||||||
|   // if index + 1 < block.challenges.length |   // if index + 1 < block.challenges.length | ||||||
| @@ -92,7 +85,13 @@ exports.returnNextChallenge = function(req, res, next) { | |||||||
|   var nameString = nextChallengeName.trim() |   var nameString = nextChallengeName.trim() | ||||||
|     .toLowerCase() |     .toLowerCase() | ||||||
|     .replace(/\s/g, '-'); |     .replace(/\s/g, '-'); | ||||||
|   return res.redirect('../challenges/' + nameString); |  | ||||||
|  |   req.user.save(function(err) { | ||||||
|  |     if (err) { | ||||||
|  |       return next(err); | ||||||
|  |     } | ||||||
|  |     return res.redirect('../challenges/' + nameString); | ||||||
|  |   }); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| exports.returnCurrentChallenge = function(req, res, next) { | exports.returnCurrentChallenge = function(req, res, next) { | ||||||
| @@ -255,7 +254,7 @@ exports.returnIndividualChallenge = function(req, res, next) { | |||||||
|         }, |         }, | ||||||
|  |  | ||||||
|         5: function() { |         5: function() { | ||||||
|           res.render('bonfire/show', { |           res.render('coursewares/showBonfire', { | ||||||
|             completedWith: null, |             completedWith: null, | ||||||
|             title: challenge.name, |             title: challenge.name, | ||||||
|             dashedName: dashedName, |             dashedName: dashedName, | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ var async = require('async'), | |||||||
|  * Cached values |  * Cached values | ||||||
|  */ |  */ | ||||||
| var allFieldGuideIds, allFieldGuideNames, allNonprofitNames, | var allFieldGuideIds, allFieldGuideNames, allNonprofitNames, | ||||||
|   allBonfireIndexesAndNames, challengeMap, challengeMapWithIds, |   challengeMap, challengeMapWithIds, | ||||||
|   challengeMapWithNames, allChallengeIds, allChallenges; |   challengeMapWithNames, allChallengeIds, allChallenges; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ mongoose.connect(secrets.db); | |||||||
| var challenges = fs.readdirSync(__dirname + '/challenges'); | var challenges = fs.readdirSync(__dirname + '/challenges'); | ||||||
|  |  | ||||||
| var counter = 0; | var counter = 0; | ||||||
| var offerings = 3; | var offerings = 2 + challenges.length; | ||||||
|  |  | ||||||
| var CompletionMonitor = function() { | var CompletionMonitor = function() { | ||||||
|   counter++; |   counter++; | ||||||
| @@ -37,12 +37,11 @@ Challenge.remove({}, function(err, data) { | |||||||
|         console.log(err); |         console.log(err); | ||||||
|       } else { |       } else { | ||||||
|         console.log('Successfully parsed %s', file); |         console.log('Successfully parsed %s', file); | ||||||
|         console.log(data); |         CompletionMonitor(); | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
| /* |  | ||||||
| FieldGuide.remove({}, function(err, data) { | FieldGuide.remove({}, function(err, data) { | ||||||
|   if (err) { |   if (err) { | ||||||
|     console.error(err); |     console.error(err); | ||||||
| @@ -76,4 +75,3 @@ Nonprofit.remove({}, function(err, data) { | |||||||
|   }); |   }); | ||||||
|   console.log('nonprofits'); |   console.log('nonprofits'); | ||||||
| }); | }); | ||||||
| */ |  | ||||||
|   | |||||||
| @@ -1,45 +0,0 @@ | |||||||
| extends ../layout-wide |  | ||||||
| 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/sandbox.js') |  | ||||||
|     .row |  | ||||||
|         script(type="text/javascript"). |  | ||||||
|             var tests = !{JSON.stringify(tests)}; |  | ||||||
|             var challengeSeed = !{JSON.stringify(challengeSeed)}; |  | ||||||
|             var challengeEntryPoint = !{JSON.stringify(challengeEntryPoint)}; |  | ||||||
|             var title = !{JSON.stringify(title)}; |  | ||||||
|  |  | ||||||
|         #mainEditorPanel.col-sm-12.col-md-7.col-xs-12 |  | ||||||
|             .panel.panel-primary.panel-bonfire |  | ||||||
|                 .panel-heading.text-center 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_v0.1.2.js') |  | ||||||
| @@ -1,45 +0,0 @@ | |||||||
| extends ../layout |  | ||||||
| block content |  | ||||||
|     .row |  | ||||||
|         .col-md-offset-2.col-md-8.col-lg-offset-2.col-lg-8.text-center |  | ||||||
|  |  | ||||||
|             h1 JSON generator for bonfire challenges - just fill the form out and get the correct format back |  | ||||||
|         .col-xs-12.col-sm-12.col-md-offset-1.col-md-10.col-lg-offset-1-col-lg-10 |  | ||||||
|             .panel |  | ||||||
|                 form.form-horizontal(method="POST", action="/bonfire-json-generator", name="bonfireInfo") |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label(for='name') name: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             input#name.form-control(type='text', placeholder='name', name="name") |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label(for='difficultyField') difficulty: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             label.radio-inline 1 |  | ||||||
|                                 input#inlineRadio1(type='radio', name='difficulty', value='1') |  | ||||||
|                             label.radio-inline 2 |  | ||||||
|                                 input#inlineRadio2(type='radio', name='difficulty', value='2') |  | ||||||
|                             label.radio-inline 3 |  | ||||||
|                                 input#inlineRadio3(type='radio', name='difficulty', value='3') |  | ||||||
|                             label.radio-inline 4 |  | ||||||
|                                 input#inlineRadio4(type='radio', name='difficulty', value='4') |  | ||||||
|                             label.radio-inline 5 |  | ||||||
|                                 input#inlineRadio5(type='radio', name='difficulty', value='5') |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label.wrappable(for='description') description: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             textarea#description.form-control(name="description", rows=5, placeholder="Each \"paragraph\" needs to be separated by a line break(return key).") |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label.wrappable(for='challengeSeed') challengeSeed: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             textarea#challengeSeed.form-control(name="challengeSeed", rows=5) |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label.wrappable(for='challengeEntryPoint') challenge entrypoint: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             textarea#name.form-control(name="challengeEntryPoint", rows=1, type='text', placeholder="palindrome(\"eye\");") |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label.wrappable(for='tests') tests: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             textarea#tests.form-control(name="tests", rows=5, placeholder="Separate tests by a newline.") |  | ||||||
|                     .form-group |  | ||||||
|                         .col-sm-offset-2.col-sm-10 |  | ||||||
|                             input.btn.btn-default(type='submit', value="submit") |  | ||||||
| @@ -1,44 +0,0 @@ | |||||||
| extends ../layout |  | ||||||
| block content |  | ||||||
|     .row |  | ||||||
|         .col-md-offset-2.col-md-8.col-lg-offset-2.col-lg-8.text-center |  | ||||||
|             h1 Welcome to the challenge generator. Test your ideas out and see them live in bonfire! |  | ||||||
|         .col-xs-12.col-sm-12.col-md-offset-1.col-md-10.col-lg-offset-1-col-lg-10 |  | ||||||
|             .panel |  | ||||||
|                 form.form-horizontal(method="POST", action="/bonfire-challenge-generator", name="bonfireInfo") |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label(for='name') name: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             input#name.form-control(type='text', placeholder='name', name="name") |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label(for='difficultyField') difficulty: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             label.radio-inline 1 |  | ||||||
|                                 input#inlineRadio1(type='radio', name='difficulty', value='1') |  | ||||||
|                             label.radio-inline 2 |  | ||||||
|                                 input#inlineRadio2(type='radio', name='difficulty', value='2') |  | ||||||
|                             label.radio-inline 3 |  | ||||||
|                                 input#inlineRadio3(type='radio', name='difficulty', value='3') |  | ||||||
|                             label.radio-inline 4 |  | ||||||
|                                 input#inlineRadio4(type='radio', name='difficulty', value='4') |  | ||||||
|                             label.radio-inline 5 |  | ||||||
|                                 input#inlineRadio5(type='radio', name='difficulty', value='5') |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label.wrappable(for='description') description: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             textarea#description.form-control(name="description", rows=5, placeholder="Each \"paragraph\" needs to be separated by a line break(return key).") |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label.wrappable(for='challengeSeed') challengeSeed: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             textarea#challengeSeed.form-control(name="challengeSeed", rows=5) |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label.wrappable(for='challengeEntryPoint') challenge entrypoint: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             textarea#name.form-control(name="challengeEntryPoint", rows=1, type='text', placeholder="palindrome(\"eye\");") |  | ||||||
|                     .form-group |  | ||||||
|                         label.col-sm-2.control-label.wrappable(for='tests') tests: |  | ||||||
|                         .col-sm-10 |  | ||||||
|                             textarea#tests.form-control(name="tests", rows=5, placeholder="Separate tests by a newline.") |  | ||||||
|                     .form-group |  | ||||||
|                         .col-sm-offset-2.col-sm-10 |  | ||||||
|                             input.btn.btn-default(type='submit', value="submit") |  | ||||||
		Reference in New Issue
	
	Block a user