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

Commit f9db8ee

Browse files
committed
added RunestoneBase inheritance to assess, also fixed wierd line-wrapping for MC
1 parent db3ce30 commit f9db8ee

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

runestone/assess/js/fitb.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,15 @@ function FITB (opts) {
4343
this.init(opts);
4444
}
4545
}
46+
47+
FITB.prototype = new RunestoneBase();
48+
4649
/*===================================
4750
=== Setting FITB variables ===
4851
===================================*/
4952

5053
FITB.prototype.init = function (opts) {
54+
RunestoneBase.apply(this, arguments);
5155
var orig = opts.orig; // entire <p> element
5256
this.origElem = orig;
5357
this.divid = orig.id;

runestone/assess/js/mchoice.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ function MultipleChoice (opts) {
3434
}
3535
}
3636

37+
MultipleChoice.prototype = new RunestoneBase();
38+
3739
/*===================================
3840
=== Setting MC variables ===
3941
===================================*/
4042

4143
MultipleChoice.prototype.init = function (opts) {
44+
RunestoneBase.apply(this, arguments);
4245
var orig = opts.orig; // entire <ul> element
4346
this.origElem = orig;
4447

@@ -198,8 +201,11 @@ MultipleChoice.prototype.renderMCFormOpts = function () {
198201

199202
// Create the label for the input
200203
var label = document.createElement("label");
201-
$(label).attr("for", optid);
202-
$(label).text(this.answerList[k].content);
204+
var labelspan = document.createElement("span");
205+
label.appendChild(input);
206+
label.appendChild(labelspan);
207+
//$(label).attr("for", optid);
208+
$(labelspan).text(this.answerList[k].content);
203209

204210
// create the object to store in optionArray
205211
var optObj = {
@@ -209,7 +215,6 @@ MultipleChoice.prototype.renderMCFormOpts = function () {
209215
this.optionArray.push(optObj);
210216

211217
// add the option to the form
212-
this.optsForm.appendChild(input);
213218
this.optsForm.appendChild(label);
214219
this.optsForm.appendChild(document.createElement("br"));
215220

runestone/assess/js/timed.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ function Timed (opts) {
1818
}
1919
}
2020

21+
Timed.prototype = new RunestoneBase();
2122

2223
/*====================================
2324
=== Setting Timed Assess Variables ===
2425
====================================*/
2526

2627
Timed.prototype.init = function (opts) {
28+
RunestoneBase.apply(this, arguments);
2729
var orig = opts.orig;
2830
this.origElem = orig; // the entire element of this timed assessment and all of its children
2931
this.divid = orig.id;

0 commit comments

Comments
 (0)