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

Commit 0083d7a

Browse files
committed
Merge pull request #43 from riknos314/timedupdates
Implemented changes to fix dependencies for timed components
2 parents 9abc5bc + 4bec5b2 commit 0083d7a

File tree

8 files changed

+95
-43
lines changed

8 files changed

+95
-43
lines changed

runestone/assess/css/bootstrap.min.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runestone/assess/js/fitb.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*==========================================
2+
======== Master fitb.js =========
3+
============================================
4+
=== This file contains the JS for the ===
5+
=== Runestone fillintheblank component. ===
6+
============================================
7+
=== Created By ===
8+
=== Isaiah Mayerchak ===
9+
=== and ===
10+
=== Kirby Olson ===
11+
=== 6/4/15 ===
12+
==========================================*/
13+
114
/*=======================================
215
=== Global functions ===
316
=== (used by more than one component) ===
@@ -343,3 +356,15 @@ FITB.prototype.compareFITB = function (data, status, whatever) { // Creates a
343356
var el = $(html);
344357
el.modal();
345358
};
359+
360+
/*=================================
361+
== Find the custom HTML tags and ==
362+
== execute our code on them ==
363+
=================================*/
364+
$(document).ready(function () {
365+
$("[data-component=fillintheblank]").each(function (index) { // FITB
366+
if ($(this.parentNode).data("component") !== "timedAssessment") { // If this element exists within a timed component, don't render it here
367+
FITBList[this.id] = new FITB({"orig": this});
368+
}
369+
});
370+
});

runestone/assess/js/mchoice.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
/*=======================================
2-
=========================================
3-
==== Begin Multiple Choice Component ====
4-
=========================================
5-
=======================================*/
1+
/*==========================================
2+
======== Master mchoice.js =========
3+
============================================
4+
=== This file contains the JS for the ===
5+
=== Runestone multiple choice component. ===
6+
============================================
7+
=== Created By ===
8+
=== Isaiah Mayerchak ===
9+
=== and ===
10+
=== Kirby Olson ===
11+
=== 6/4/15 ===
12+
==========================================*/
613

714
var feedBack = function (elem, correct, feedbackText) { // Displays feedback on page--miscellaneous function that can be used by multple objects
815
// elem is the Element in which to put the feedback
@@ -527,3 +534,16 @@ MultipleChoice.prototype.compareAnswers = function () {
527534
data.course = eBookConfig.course;
528535
jQuery.get(eBookConfig.ajaxURL + "getaggregateresults", data, this.compareModal);
529536
};
537+
538+
/*=================================
539+
== Find the custom HTML tags and ==
540+
== execute our code on them ==
541+
=================================*/
542+
$(document).ready(function () {
543+
$("[data-component=multiplechoice]").each(function (index) { // MC
544+
if ($(this.parentNode).data("component") !== "timedAssessment") { // If this element exists within a timed component, don't render it here
545+
mcList[this.id] = new MultipleChoice({"orig": this});
546+
}
547+
});
548+
549+
});

runestone/assess/js/timed.js

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
/*===================================
2-
=====================================
3-
==== Begin Timed Assessment Code ====
4-
=====================================
5-
===================================*/
1+
/*==========================================
2+
======== Master timed.js =========
3+
============================================
4+
=== This file contains the JS for ===
5+
=== the Runestone timed component. ===
6+
============================================
7+
=== Created By ===
8+
=== Kirby Olson ===
9+
=== 6/11/15 ===
10+
==========================================*/
611

712
var TimedList = {}; // Timed dictionary
813

@@ -257,6 +262,10 @@ Timed.prototype.createRenderedQuestionArray = function () {
257262
} else if ($(tmpChild).is("[data-component=fillintheblank]")) {
258263
var newFITB = new TimedFITB({"orig": tmpChild});
259264
this.renderedQuestionArray.push(newFITB);
265+
} else if ($(tmpChild).is("[data-component=dragndrop]")) {
266+
this.renderedQuestionArray.push(new TimedDragNDrop({"orig": tmpChild}));
267+
} else if ($(tmpChild).is("[data-component=clickablearea]")) {
268+
this.renderedQuestionArray.push(new TimedClickableArea({"orig":tmpChild}));
260269
}
261270
}
262271
if (this.random) {
@@ -472,20 +481,7 @@ Timed.prototype.submitTimedProblems = function () {
472481

473482
Timed.prototype.hideTimedFeedback = function () {
474483
for (var i = 0; i < this.renderedQuestionArray.length; i++) {
475-
var blanks = this.renderedQuestionArray[i].blankArray;
476-
if (blanks !== undefined) {
477-
for (var j = 0; j < blanks.length; j++) {
478-
$(blanks[j]).removeClass("input-validation-error");
479-
}
480-
this.renderedQuestionArray[i].feedBackDiv.style.display = "none";
481-
}
482-
var feedbacks = this.renderedQuestionArray[i].feedBackEachArray;
483-
if (feedbacks !== undefined) {
484-
for (var j = 0; j < feedbacks.length; j++) {
485-
$(feedbacks[j]).hide();
486-
}
487-
}
488-
484+
this.renderedQuestionArray[i].hideFeedback(); // Defined in each timed class
489485
}
490486
};
491487

@@ -550,22 +546,4 @@ $(document).ready(function () {
550546
$("[data-component=timedAssessment]").each(function (index) {
551547
TimedList[this.id] = new Timed({"orig": this});
552548
});
553-
for (var key in TimedList) {
554-
if (TimedList.hasOwnProperty(key)) {
555-
var TimedChildren = TimedList[key].origElem.childNodes;
556-
}
557-
}
558-
559-
$("[data-component=fillintheblank]").each(function (index) { // FITB
560-
if ($.inArray(this.id, TimedChildren) < 0) { // If the fillintheblank element exists within a timed component, don"t render it here
561-
FITBList[this.id] = new FITB({"orig": this});
562-
}
563-
});
564-
565-
$("[data-component=multiplechoice]").each(function (index) { // MC
566-
if ($.inArray(this.id, TimedChildren) < 0) { // If the MC element exists within a timed component, don"t render it here
567-
mcList[this.id] = new MultipleChoice({"orig": this});
568-
}
569-
});
570-
571549
});

runestone/assess/js/timedfitb.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// FITB constructor
21
function TimedFITB (opts) {
32
if (opts) {
43
this.timedInit(opts);
@@ -39,6 +38,16 @@ TimedFITB.prototype.checkCorrectTimed = function () {
3938
return this.correct;
4039
};
4140

41+
TimedFITB.prototype.hideFeedback = function () {
42+
for (var i = 0; i < this.blankArray.length; i++) {
43+
$(this.blankArray[i]).removeClass("input-validation-error");
44+
}
45+
this.feedBackDiv.style.display = "none";
46+
};
47+
4248
TimedFITB.prototype.processTimedSubmission = function () {
49+
for (var i = 0; i < this.blankArray.length; i++) {
50+
this.blankArray[i].disabled = true;
51+
}
4352
this.checkFITBStorage();
4453
};

runestone/assess/js/timedmc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,16 @@ TimedMC.prototype.checkCorrectTimed = function () {
127127
}
128128
};
129129

130+
TimedMC.prototype.hideFeedback = function () {
131+
for (var i = 0; i < this.feedBackEachArray.length; i++) {
132+
$(this.feedBackEachArray[i]).hide();
133+
}
134+
};
135+
130136
TimedMC.prototype.processTimedSubmission = function () {
137+
for (var i = 0; i < this.optionArray.length; i++) {
138+
this.optionArray[i]["input"].disabled = true;
139+
}
131140
if (this.multipleanswers) {
132141
this.processMCMASubmission();
133142
} else {

runestone/clickableArea/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
def setup(app):
2424
app.add_directive('clickablearea',ClickableArea)
2525
app.add_javascript('clickable.js')
26+
app.add_javascript('timedclickable.js')
2627
app.add_stylesheet('clickable.css')
2728

2829
app.add_node(ClickableAreaNode, html=(visit_ca_node, depart_ca_node))

runestone/dragndrop/dragndrop.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
def setup(app):
2424
app.add_directive('dragndrop',DragNDrop)
2525
app.add_javascript('dragndrop.js')
26+
app.add_javascript('timeddnd.js')
2627
app.add_stylesheet('dragndrop.css')
2728

2829
app.add_node(DragNDropNode, html=(visit_dnd_node, depart_dnd_node))

0 commit comments

Comments
 (0)