Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
Add: Decorate Webwork Q’s to indicate correctness
Browse files Browse the repository at this point in the history
  • Loading branch information
bnmnetp committed Feb 3, 2023
1 parent ca208d1 commit d8bf9e7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
24 changes: 19 additions & 5 deletions runestone/common/css/runestone-custom-sphinx-bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
--successAlerts: #217300;
--componentBgColor: #07467d;
--componentBorderColor: #939090;
--questionBgColor: rgb(23, 85, 93);
--questionBgColor: rgb(23, 85, 93);
}

/* custom modification of basic.css for color-contrast (AA compliant) */
Expand Down Expand Up @@ -245,11 +245,11 @@ div.container {
max-width: var(--contentWidthRegular);
margin-left: auto;
margin-right: auto;

}

/* Handle content in nested sections by allowing them to grow*/
#main-content section > section,
#main-content section > section,
/* And then make sure a few items are wider by default */
#main-content section > .runestone.ac_section,
#main-content section > .runestone.codelens,
Expand Down Expand Up @@ -1161,6 +1161,20 @@ margin-right: 3px;
}

.adcopy .donateb {

margin-left: 30%;
}
}

.isCorrect:before {
/*content: url(https://em-content.zobj.net/thumbs/240/apple/325/check-mark_2714-fe0f.png);*/
content: "✅ ";
float:right;
padding-left: 4px;
}

.isInCorrect:before {
/*content: url(https://em-content.zobj.net/thumbs/240/apple/325/check-mark_2714-fe0f.png);*/
content: "⚠️ ";
float:right;
padding-left: 4px;
}
13 changes: 13 additions & 0 deletions runestone/common/js/runestonebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,19 @@ export default class RunestoneBase {
}
}

decorateStatus() {
let rsDiv = $(this.containerDiv).closest("div.runestone")[0];
if (this.correct) {
rsDiv.classList.add("isCorrect");
} else {
if (this.correct === null) {
rsDiv.classList.add("notAnswered");
} else {
rsDiv.classList.add("isInCorrect");
}
}
}

}


Expand Down
3 changes: 3 additions & 0 deletions runestone/webwork/js/webwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class WebWork extends RunestoneBase {
}
// data.answers comes from postgresql as a JSON column type so no need to parse it.
this.answers = data.answer;
this.correct = data.correct;
this.percent = data.percent;
this.decorateStatus();
}

checkLocalStorage() {
Expand Down

0 comments on commit d8bf9e7

Please sign in to comment.