Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions runestone/parsons/css/parsons.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions runestone/parsons/images/parsons-indent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 16 additions & 3 deletions runestone/parsons/js/parsons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = {};
}
Expand Down Expand Up @@ -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({
Expand All @@ -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;
Expand Down