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

Commit 6375481

Browse files
committed
Add component id as caption for all gradeable elements
1 parent 3fb3df0 commit 6375481

14 files changed

Lines changed: 66 additions & 15 deletions

File tree

runestone/activecode/js/activecode.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ ActiveCode.prototype.init = function(opts) {
9595
if ($(orig).data('caption')) {
9696
this.caption = $(orig).data('caption');
9797
} else {
98-
this.caption = ""
98+
this.caption = "ActiveCode"
9999
}
100-
this.addCaption();
100+
this.addCaption('runestone');
101101
this.addJSONLibrary();
102102

103103
if (this.autorun) {
@@ -573,15 +573,6 @@ ActiveCode.prototype.downloadFile = function (lang) {
573573
}
574574
};
575575

576-
ActiveCode.prototype.addCaption = function() {
577-
//someElement.parentNode.insertBefore(newElement, someElement.nextSibling);
578-
var capDiv = document.createElement('p');
579-
$(capDiv).html(this.caption + " (" + this.divid + ")");
580-
$(capDiv).addClass("ac_caption");
581-
$(capDiv).addClass("ac_caption_text");
582-
583-
this.outerDiv.parentNode.insertBefore(capDiv, this.outerDiv.nextSibling);
584-
};
585576

586577

587578

runestone/assess/js/mchoice.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ MultipleChoice.prototype.init = function (opts) {
3434
this.useRunestoneServices = opts.useRunestoneServices;
3535
this.multipleanswers = false;
3636
this.divid = orig.id;
37+
this.caption = 'Multiple Choice'
3738

3839
if ($(this.origElem).data("multipleanswers") === true) {
3940
this.multipleanswers = true;
@@ -60,6 +61,8 @@ MultipleChoice.prototype.init = function (opts) {
6061
this.createCorrectList();
6162
this.createMCForm();
6263
this.checkServer("mChoice");
64+
65+
this.addCaption('runestone');
6366
};
6467

6568
/*====================================

runestone/clickableArea/js/clickable.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ ClickableArea.prototype.init = function (opts) {
5454
this.getQuestion();
5555
this.getFeedback();
5656
this.renderNewElements();
57+
58+
this.caption="Clickable"
59+
this.addCaption('runestone')
60+
5761
};
5862

5963
/*===========================

runestone/codelens/visualizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def setup(app):
4242
<div class="runestone" style="max-width: none;">
4343
<div class="%(divclass)s">
4444
<div id="%(divid)s"></div>
45-
<p class="cl_caption"><span class="cl_caption_text">%(caption)s (%(divid)s)</span> </p>
45+
<p class="runestone_caption"><span class="runestone_caption_text">CodeLens: %(caption)s (%(divid)s)</span> </p>
4646
</div>'''
4747

4848
QUESTION = '''

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ div.ExecutionVisualizer table#pyCodeOutput .lineNo {
5858
body {
5959
padding-top: 60px;
6060
background-color: #eeeeee;
61+
counter-reset: rscomponent;
6162
}
6263

6364
pre {
@@ -866,4 +867,14 @@ textarea#lp-result {
866867

867868
#subchapterprogress > div {
868869
background: green;
869-
}
870+
}
871+
872+
.runestone_caption {
873+
text-align: center;
874+
}
875+
876+
.runestone_caption:before {
877+
content: "Activity: " counter(rscomponent) " -- ";
878+
counter-increment: rscomponent;
879+
}
880+

runestone/common/js/runestonebase.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ RunestoneBase.prototype.logBookEvent = function (eventInfo) {
3838
null, 'json');
3939
}
4040
console.log("logging event " + JSON.stringify(eventInfo));
41-
pageProgressTracker.updateProgress(eventInfo.div_id);
41+
if (typeof pageProgressTracker.updateProgress === "function") {
42+
pageProgressTracker.updateProgress(eventInfo.div_id);
43+
}
4244
return post_return;
4345
};
4446

@@ -61,7 +63,9 @@ RunestoneBase.prototype.logRunEvent = function (eventInfo) {
6163
this.forceSave = true; }).bind(this))
6264
}
6365
console.log("running " + JSON.stringify(eventInfo));
64-
pageProgressTracker.updateProgress(eventInfo.div_id);
66+
if (typeof pageProgressTracker.updateProgress === "function") {
67+
pageProgressTracker.updateProgress(eventInfo.div_id);
68+
}
6569

6670
};
6771

@@ -137,3 +141,15 @@ RunestoneBase.prototype.shouldUseServer = function (data) {
137141
RunestoneBase.prototype.localStorageKey = function () {
138142
return eBookConfig.email + ":" + eBookConfig.course + ":" + this.divid + "-given";
139143
}
144+
145+
146+
RunestoneBase.prototype.addCaption = function(elType) {
147+
//someElement.parentNode.insertBefore(newElement, someElement.nextSibling);
148+
var capDiv = document.createElement('p');
149+
$(capDiv).html(this.caption + " (" + this.divid + ")");
150+
$(capDiv).addClass(`${elType}_caption`);
151+
$(capDiv).addClass(`${elType}_caption_text`);
152+
153+
//this.outerDiv.parentNode.insertBefore(capDiv, this.outerDiv.nextSibling);
154+
this.containerDiv.appendChild(capDiv);
155+
};

runestone/dragndrop/js/dragndrop.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ DragNDrop.prototype.init = function (opts) {
3939
this.populate(); // Populates this.dragPairArray, this.feedback and this.question
4040

4141
this.createNewElements();
42+
43+
this.caption="Drag-N-Drop"
44+
this.addCaption('runestone')
45+
4246
};
4347
/*======================
4448
=== Update variables ===

runestone/fitb/js/fitb.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ FITB.prototype.init = function (opts) {
4141

4242
this.createFITBElement();
4343
this.checkServer("fillb");
44+
this.caption="Fill in the Blank";
45+
this.addCaption('runestone');
46+
4447
};
4548

4649
// Find the script tag containing JSON in a given root DOM node.

runestone/parsons/js/parsons.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,9 @@ Parsons.prototype.init = function (opts) {
11181118
} else {
11191119
this.checkLocalStorage();
11201120
}
1121+
1122+
this.caption="Parsons"
1123+
this.addCaption('runestone')
11211124
};
11221125

11231126
// Based on the data-fields in the original HTML, initialize options

runestone/poll/js/poll.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Poll.prototype.init = function (opts) {
3131
this.getOptionText(); //populates optionList
3232
this.renderPoll(); //generates HTML
3333
this.checkPollStorage(); //checks localStorage to see if this poll has already been completed by this user
34+
35+
this.caption="Poll"
36+
this.addCaption('runestone')
3437
};
3538

3639
Poll.prototype.getQuestionText = function() {

0 commit comments

Comments
 (0)