Commit 99b6c395 by Albert St. Aubin

update to correct timing bug with render of Discussions

parent 32d445e0
......@@ -37,12 +37,18 @@
render: function() {
var numberAvailableSchemes = this.discussionSettings.attributes.available_division_schemes.length;
HtmlUtils.setHtml(this.$el, this.template({
availableSchemes: this.getDivisionSchemeData(this.discussionSettings.attributes.division_scheme), // eslint-disable-line max-len
layoutClass: numberAvailableSchemes === 2 ? THREE_COLUMN_CLASS : TWO_COLUMN_CLASS
}));
this.updateTopicVisibility(this.getSelectedScheme(), this.getTopicNav());
this.renderTopics();
if (this.isSchemeAvailable(COHORT) ||
(!this.isSchemeAvailable(COHORT) && this.getSelectedScheme() === COHORT)) {
this.showCohortSchemeControl(true);
}
return this;
},
......@@ -88,6 +94,16 @@
},
cohortStateUpdate: function(state) {
var cohortIndex;
if (state.is_cohorted && !this.isSchemeAvailable(COHORT)) {
this.discussionSettings.attributes.available_division_schemes.push(COHORT);
} else if (!state.is_cohorted && this.getSelectedScheme() !== COHORT) {
cohortIndex = this.discussionSettings.attributes.available_division_schemes.indexOf(COHORT);
if (cohortIndex > -1) {
this.discussionSettings.attributes.available_division_schemes.splice(cohortIndex, 1);
}
}
if (!this.isSchemeAvailable(ENROLLMENT_TRACK)) {
this.showDiscussionManagement(state.is_cohorted);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment