MDL-82784 course: Don't try to change a non-existant add section button

This commit is contained in:
James C
2024-08-21 14:59:24 +12:00
parent e0a9cf2288
commit 91c8d671ca
3 changed files with 8 additions and 6 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -767,10 +767,12 @@ export default class extends BaseComponent {
}
});
const courseAddSection = this.getElement(this.selectors.COURSEADDSECTION);
const addSection = courseAddSection.querySelector(this.selectors.ADDSECTION);
addSection.classList.toggle(this.classes.DISPLAYNONE, locked);
const noMoreSections = courseAddSection.querySelector(this.selectors.MAXSECTIONSWARNING);
noMoreSections.classList.toggle(this.classes.DISPLAYNONE, !locked);
if (courseAddSection) {
const addSection = courseAddSection.querySelector(this.selectors.ADDSECTION);
addSection.classList.toggle(this.classes.DISPLAYNONE, locked);
const noMoreSections = courseAddSection.querySelector(this.selectors.MAXSECTIONSWARNING);
noMoreSections.classList.toggle(this.classes.DISPLAYNONE, !locked);
}
}
/**