Skip to content

Commit 5ea8d51

Browse files
committed
boom v2
1 parent c96daaf commit 5ea8d51

3 files changed

Lines changed: 43 additions & 3 deletions

File tree

‎v3/css/opt-frontend.css‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,7 @@ button.surveyBtn {
209209
#syntaxErrSubmitBtn, #syntaxErrCloseBtn {
210210
margin-right: 8px;
211211
}
212+
213+
#syntaxErrHideAllLink {
214+
font-size: 7pt;
215+
}

‎v3/js/opt-frontend-common.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,9 @@ function optFinishSuccessfulExecution() {
12461246
// successfully executes a piece of code
12471247
initializeDisplayModeSurvey();
12481248

1249-
if (activateSyntaxErrorSurvey && experimentalPopUpSyntaxErrorSurvey) {
1249+
if (typeof(activateSyntaxErrorSurvey) !== 'undefined' &&
1250+
activateSyntaxErrorSurvey &&
1251+
experimentalPopUpSyntaxErrorSurvey) {
12501252
experimentalPopUpSyntaxErrorSurvey();
12511253
}
12521254
}

‎v3/js/opt-frontend.js‎

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ function experimentalPopUpSyntaxErrorSurvey() {
276276
var myUuid = supports_html5_storage() ? localStorage.getItem('opt_uuid') : '';
277277

278278
// Wording of the survey bubble:
279-
var version = 'v1'; // v1 - deployed on 2015-04-20
280-
279+
/*
280+
var version = 'v1'; // deployed on 2015-04-19, revoked on 2015-04-20
281281
var surveyBubbleHTML = '<div id="syntaxErrBubbleContents">\
282282
<div id="syntaxErrHeader">You just fixed the following error:</div>\
283283
<div id="syntaxErrCodeDisplay"></div>\
@@ -289,7 +289,21 @@ function experimentalPopUpSyntaxErrorSurvey() {
289289
<button id="syntaxErrCloseBtn" type="button">Close</button>\
290290
</div>\
291291
</div>'
292+
*/
292293

294+
var version = 'v2'; // deployed on 2015-04-20
295+
var surveyBubbleHTML = '<div id="syntaxErrBubbleContents">\
296+
<div id="syntaxErrHeader">You just fixed the following error:</div>\
297+
<div id="syntaxErrCodeDisplay"></div>\
298+
<div id="syntaxErrMsg"></div>\
299+
<div id="syntaxErrQuestion">\
300+
If you think this message wasn\'t helpful, what would have been the best error message for you here?<br/>\
301+
<input type="text" id="syntaxErrTxtInput" size=60 maxlength=150/><br/>\
302+
<button id="syntaxErrSubmitBtn" type="button">Submit</button>\
303+
<button id="syntaxErrCloseBtn" type="button">Close</button>\
304+
<a href="#" id="syntaxErrHideAllLink">Hide all pop-ups</a>\
305+
</div>\
306+
</div>'
293307

294308
$(bub.qTipContentID()).html(surveyBubbleHTML);
295309

@@ -331,6 +345,26 @@ function experimentalPopUpSyntaxErrorSurvey() {
331345
bub.destroyQTip();
332346
});
333347

348+
$(bub.qTipContentID() + ' #syntaxErrHideAllLink').click(function() {
349+
// grab the value anyways in case the learner wrote something decent ...
350+
var res = $(bub.qTipContentID() + ' #syntaxErrTxtInput').val();
351+
var resObj = {appState: getAppState(),
352+
exc: prevExecutionExceptionObj, // note that prevExecutionExceptionObjLst is BLOWN AWAY by now
353+
opt_uuid: myUuid,
354+
reply: res,
355+
type: 'killall',
356+
v: version};
357+
358+
activateSyntaxErrorSurvey = false; // global!
359+
360+
//console.log(resObj);
361+
$.get('syntax_err_survey.py', {arg: JSON.stringify(resObj)}, function(dat) {});
362+
363+
bub.destroyQTip();
364+
365+
return false; // otherwise the 'a href' will trigger a page reload, ergh!
366+
});
367+
334368

335369
var bubbleAceEditor = ace.edit('syntaxErrCodeDisplay');
336370
// set the size and value ASAP to get alignment working well ...

0 commit comments

Comments
 (0)