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

Commit d8bf9e7

Browse files
committed
Add: Decorate Webwork Q’s to indicate correctness
1 parent ca208d1 commit d8bf9e7

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

runestone/common/css/runestone-custom-sphinx-bootstrap.css

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
--successAlerts: #217300;
4747
--componentBgColor: #07467d;
4848
--componentBorderColor: #939090;
49-
--questionBgColor: rgb(23, 85, 93);
49+
--questionBgColor: rgb(23, 85, 93);
5050
}
5151

5252
/* custom modification of basic.css for color-contrast (AA compliant) */
@@ -245,11 +245,11 @@ div.container {
245245
max-width: var(--contentWidthRegular);
246246
margin-left: auto;
247247
margin-right: auto;
248-
248+
249249
}
250250

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

11631163
.adcopy .donateb {
1164-
1164+
11651165
margin-left: 30%;
1166-
}
1166+
}
1167+
1168+
.isCorrect:before {
1169+
/*content: url(https://em-content.zobj.net/thumbs/240/apple/325/check-mark_2714-fe0f.png);*/
1170+
content: "✅ ";
1171+
float:right;
1172+
padding-left: 4px;
1173+
}
1174+
1175+
.isInCorrect:before {
1176+
/*content: url(https://em-content.zobj.net/thumbs/240/apple/325/check-mark_2714-fe0f.png);*/
1177+
content: "⚠️ ";
1178+
float:right;
1179+
padding-left: 4px;
1180+
}

runestone/common/js/runestonebase.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,19 @@ export default class RunestoneBase {
476476
}
477477
}
478478

479+
decorateStatus() {
480+
let rsDiv = $(this.containerDiv).closest("div.runestone")[0];
481+
if (this.correct) {
482+
rsDiv.classList.add("isCorrect");
483+
} else {
484+
if (this.correct === null) {
485+
rsDiv.classList.add("notAnswered");
486+
} else {
487+
rsDiv.classList.add("isInCorrect");
488+
}
489+
}
490+
}
491+
479492
}
480493

481494

runestone/webwork/js/webwork.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class WebWork extends RunestoneBase {
3131
}
3232
// data.answers comes from postgresql as a JSON column type so no need to parse it.
3333
this.answers = data.answer;
34+
this.correct = data.correct;
35+
this.percent = data.percent;
36+
this.decorateStatus();
3437
}
3538

3639
checkLocalStorage() {

0 commit comments

Comments
 (0)