From c422f9474be5b5c2a99dcd765c2ac0c60f6df15b Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Wed, 21 Jan 2015 17:17:45 -0500 Subject: [PATCH] More improvements, keyboard shortcuts working again, extra protection against fatal errors --- controllers/bonfire.js | 1 + public/js/lib/bonfire/bonfire.js | 1 + public/js/lib/bonfire/framework.js | 8 ++++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/controllers/bonfire.js b/controllers/bonfire.js index 86421feeaa7..a4fbabad51c 100644 --- a/controllers/bonfire.js +++ b/controllers/bonfire.js @@ -7,6 +7,7 @@ var _ = require('lodash'), */ exports.index = function(req, res) { res.render('bonfire/bonfire.jade', { + title: 'Learn to code with Bonfire - Free Code Camp' }); //Bonfire.find({}, null, { sort: { bonfireNumber: 1 } }, function(err, c) { // if (err) { diff --git a/public/js/lib/bonfire/bonfire.js b/public/js/lib/bonfire/bonfire.js index 720adb22c91..19be8fb1160 100644 --- a/public/js/lib/bonfire/bonfire.js +++ b/public/js/lib/bonfire/bonfire.js @@ -43,6 +43,7 @@ var api = { //print('input', data.input); if (data.error) { print('Error', data); + reset(); } else { print(null, data); } diff --git a/public/js/lib/bonfire/framework.js b/public/js/lib/bonfire/framework.js index cd60546f2fb..726894d387b 100644 --- a/public/js/lib/bonfire/framework.js +++ b/public/js/lib/bonfire/framework.js @@ -14,7 +14,7 @@ var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("codeEditor") onKeyEvent: doLinting, extraKeys : { "Ctrl-Enter" : function() { - submit(myCodeMirror.getValue()); + bonfireExecute(); return false; } } @@ -104,6 +104,10 @@ var scrapeTests = function(js) { }; $('#submitButton').on('click', function () { + bonfireExecute(); +}); + +function bonfireExecute() { tests = undefined; $('#codeOutput').empty(); var js = myCodeMirror.getValue(); @@ -118,7 +122,7 @@ $('#submitButton').on('click', function () { runTests(null, message); } }); -}); +} var pushed = false; var createTestDisplay = function() {