diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-02-23 17:31:56 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-02-23 17:31:56 +0100 |
commit | 1dd4d473bb136c607eeea3a2d655b3f56e5aeee8 (patch) | |
tree | 3c9c8999bc7e2e5af2e53f6485ac1f213f253cd4 /js/codeq/prolog.js | |
parent | 2fa2481829bda1f475c7f9681551631cb0ba6b4f (diff) |
Remove explicit "Hint" button
Hints are now generated for each tested program, and the user can press
a button to reveal the hints.
Diffstat (limited to 'js/codeq/prolog.js')
-rw-r--r-- | js/codeq/prolog.js | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js index b2ea3e1..3d34423 100644 --- a/js/codeq/prolog.js +++ b/js/codeq/prolog.js @@ -33,9 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ jqAllQuadrants = jqDescription.add(jqCode).add(jqConsole).add(jqInfo), // all the quadrants // buttons jqBtnPlan = jqScreen.find('.btn-plan'), - jqBtnHint = jqScreen.find('.btn-hint').ladda(), jqBtnTest = jqScreen.find('.btn-test').ladda(), - jqAllButtons = jqBtnPlan.add(jqBtnHint).add(jqBtnTest), // all the buttons + jqAllButtons = jqBtnPlan.add(jqBtnTest), // all the buttons // misc currentSubState = null, transitionEventName = 'mousedown',//event name of the event which will trigger the transition between these substates - the most common transition at least (there are some corner cases on the hint and test buttons -> see the code below) @@ -251,7 +250,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ }), activityHandler = codeq.makeActivityHandler(editor, problemDef.id), terminal = makePrologTerminalHandler(jqTerminal, editor, problemDef.id, activityHandler), - hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'prolog_hints', problemDef, commonDef), + hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'prolog_hints', problemDef, commonDef, activityHandler), commError = function (error) { alert(error); }; @@ -279,42 +278,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ }); jqBtnPlan.on('click', function () { - activityHandler.queueTrace({'typ': 'plan'}); if (!hinter.planNext()) { jqBtnPlan.prop('disabled', true).blur(); } }); - jqBtnHint.on('click', function () { - editor.setOption('readOnly', true); - terminal.inputDisable(); - jqBtnTest.prop('disabled', true); - jqBtnHint.ladda('start'); - codeq.comms.sendHint({ - 'program': editor.getDoc().getValue(), - 'problem_id': problemDef.id - }) - .then(function (data) { - if (data.code === 0) { - activityHandler.queueTrace({'typ': 'hint', 'feedback': data.hints}); - hinter.handle(data.hints); - } - else { - terminal.append(data.message + '\n', 'error'); - } - }) - .fail(commError) - .fin(function () { - editor.setOption('readOnly', false); - terminal.inputEnable(); - jqBtnHint.ladda('stop'); - jqBtnTest.prop('disabled', false); - }) - .done(); - }); + jqBtnTest.on('click', function () { editor.setOption('readOnly', true); terminal.inputDisable(); - jqBtnHint.prop('disabled', true); jqBtnTest.ladda('start'); codeq.comms.sendTest({ 'program': editor.getDoc().getValue(), @@ -322,7 +293,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ }) .then(function (data) { if (data.code === 0) { - activityHandler.queueTrace({'typ': 'test', 'feedback': data.hints}); hinter.handle(data.hints); } else { @@ -334,7 +304,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ editor.setOption('readOnly', false); terminal.inputEnable(); jqBtnTest.ladda('stop'); - jqBtnHint.prop('disabled', false); }) .done(); }); |