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

Commit bddfc14

Browse files
authored
Merge pull request #1371 from amy21206/master
Fixing hparsons directive cannot loaded in selectquestions
2 parents 9b32953 + 8bb0e20 commit bddfc14

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

runestone/hparsons/hparsons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def setup(app):
3737

3838

3939
TEMPLATE_START = """
40-
<div>
40+
<div class="runestone">
4141
<div data-component="hparsons" id=%(divid)s data-question_label="%(question_label)s" class="alert alert-warning hparsons_section">
4242
<div class="hp_question col-md-12">
4343
"""

runestone/hparsons/js/blockGrader.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ export default class BlockBasedGrader {
9494
state = "correct";
9595
} else if (!isCorrectOrder && state != "incorrectTooShort") {
9696
state = "incorrectMoveBlocks";
97+
} else if (!this.correctLength && state != "incorrectTooShort") {
98+
state = "incorrectMoveBlocks";
9799
}
98100
this.calculatePercent();
99101
this.graderState = state;

runestone/hparsons/js/hparsons-sql.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if (hpList === undefined) hpList = {};
1111

1212
import "./horizontal-parsons.js";
1313

14-
export default class SQLHParons extends RunestoneBase {
14+
export default class SQLHParsons extends RunestoneBase {
1515
constructor(opts) {
1616
super(opts);
1717
// copied from activecode
@@ -75,6 +75,7 @@ export default class SQLHParons extends RunestoneBase {
7575

7676
// copied from activecode, already modified to add parsons
7777
createEditor() {
78+
console.log('test create editor hparsons')
7879
this.outerDiv = document.createElement("div");
7980
$(this.origElem).replaceWith(this.outerDiv);
8081
let parsonsHTML = `<horizontal-parsons id='${this.divid}-hparsons'`;
@@ -159,6 +160,7 @@ export default class SQLHParons extends RunestoneBase {
159160
}
160161
}
161162

163+
162164
/*=================================
163165
== Find the custom HTML tags and ==
164166
== execute our code on them ==
@@ -168,7 +170,7 @@ $(document).on("runestone:login-complete", function () {
168170
if ($(this).closest("[data-component=timedAssessment]").length == 0) {
169171
// If this element exists within a timed component, don't render it here
170172
// try {
171-
hpList[this.id] = new SQLHParons({
173+
hpList[this.id] = new SQLHParsons({
172174
orig: this,
173175
useRunestoneServices: eBookConfig.useRunestoneServices,
174176
});
@@ -179,3 +181,10 @@ $(document).on("runestone:login-complete", function () {
179181
}
180182
});
181183
});
184+
185+
if (typeof window.component_factory === "undefined") {
186+
window.component_factory = {};
187+
}
188+
window.component_factory["hparsons"] = function (opts) {
189+
return new SQLHParsons(opts);
190+
};

0 commit comments

Comments
 (0)