fix: make 'conditional' xblocks work again after being broken

I accidentally broke them in commit b90039b2 by passing in an
extra argument to display.js constructors.

TNL-8318
This commit is contained in:
Michael Terry
2021-05-14 09:09:17 -04:00
parent da9afe6290
commit 71a8a9fb56
2 changed files with 7 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
/* eslint-disable */
(function() {
this.Conditional = (function() {
function Conditional(element, callerElId) {
function Conditional(element, runtime, callerElId) {
var dependencies;
this.el = $(element).find('.conditional-wrapper');
this.callerElId = callerElId;

View File

@@ -63,7 +63,8 @@
// Initialize Conditional constructors.
if (_this.wrapperSectionEl !== null) {
$(_this.wrapperSectionEl).find('.xmodule_ConditionalModule').each(function(index, value) {
new window.Conditional(value, _this.id.replace(/^poll_/, ''));
// eslint-disable-next-line no-new
new window.Conditional(value, _this.runtime, _this.id.replace(/^poll_/, ''));
});
}
}
@@ -103,7 +104,8 @@
// notifying the constructor that this is a reset operation.
if (_this.wrapperSectionEl !== null) {
$(_this.wrapperSectionEl).find('.xmodule_ConditionalModule').each(function(index, value) {
new window.Conditional(value, _this.id.replace(/^poll_/, ''));
// eslint-disable-next-line no-new
new window.Conditional(value, _this.runtime, _this.id.replace(/^poll_/, ''));
});
}
}
@@ -234,9 +236,10 @@
return PollMain;
function PollMain(el) {
function PollMain(el, runtime) {
var _this;
this.runtime = runtime;
this.questionEl = $(el).find('.poll_question');
if (this.questionEl.length !== 1) {
// We require one question DOM element.