diff --git a/runestone/parsons/css/parsons.css b/runestone/parsons/css/parsons.css index f6e78242b..0c19ca74d 100644 --- a/runestone/parsons/css/parsons.css +++ b/runestone/parsons/css/parsons.css @@ -99,20 +99,17 @@ .parsons .incorrectIndent { border: 1px solid red; border-left: 10px solid red; + border-right: 10px solid red; padding-left: 1px; -} -.parsons .correctIndent { - border: 1px solid green; - border-left: 10px solid green; + padding-right: 1px; + background-image: url('parsons-indent.svg'); + background-repeat: no-repeat; + background-position: center; } .parsons .incorrectPosition { background-color: #FFBABA; border:1px solid red; } -.parsons .correctPosition { - background-color: #DFF2BF; - border:1px solid green; -} .parsons { border-left:0; border-right:0; diff --git a/runestone/parsons/images/parsons-indent.svg b/runestone/parsons/images/parsons-indent.svg new file mode 100644 index 000000000..7643a0a40 --- /dev/null +++ b/runestone/parsons/images/parsons-indent.svg @@ -0,0 +1,8 @@ + + + + + + + diff --git a/runestone/parsons/js/parsons.js b/runestone/parsons/js/parsons.js index ea3c22b1c..41f4e86d2 100644 --- a/runestone/parsons/js/parsons.js +++ b/runestone/parsons/js/parsons.js @@ -127,7 +127,6 @@ LineBasedGrader.prototype.grade = function() { $(block.view).addClass("incorrectIndent"); } } - answerArea.addClass("incorrect"); feedbackArea.fadeIn(500); feedbackArea.attr("class", "alert alert-danger"); if (incorrectBlocks.length == 1) { @@ -359,7 +358,11 @@ Parsons.prototype.init = function (opts) { this.initializeLines(content); this.initializeView(); // Check the server for an answer to complete things - this.checkServer("parsons"); + if (this.useRunestoneServices) { + this.checkServer("parsons"); + } else { + this.checkLocalStorage(); + } }; // Based on the data-fields in the original HTML, initialize options @@ -753,7 +756,11 @@ Parsons.prototype.loadData = function(data) { Parsons.prototype.localData = function() { var data = localStorage.getItem(this.storageId); if (data !== null) { - data = JSON.parse(data); + if (data.charAt(0) == "{") { + data = JSON.parse(data); + } else { + data = {}; + } } else { data = {}; } @@ -794,6 +801,9 @@ Parsons.prototype.setLocalStorage = function(data) { // move: the user moved a block to a new position // reset: the reset button was pressed Parsons.prototype.logMove = function(activity) { + if (!this.useRunestoneServices) { + return this; + } var act = activity + "|" + this.sourceHash() + "|" + this.answerHash(); var divid = this.divid; this.logBookEvent({ @@ -807,6 +817,9 @@ Parsons.prototype.logMove = function(activity) { // correct: The answer given matches the solution // incorrect*: The answer is wrong for various reasons Parsons.prototype.logAnswer = function(answer) { + if (!this.useRunestoneServices) { + return this; + } var answerHash = this.answerHash(); var sourceHash = this.sourceHash(); var act = sourceHash + "|" + answerHash;