MDL-62748 course: maxsections is a limit

For course formats shipped with core, maxsections should be a limit to the number of sections
allowed in the course.
This commit is contained in:
Damyon Wiese 2018-07-16 15:58:49 +08:00 committed by Jenkins
parent f468f6d02a
commit 7c05d8a3d2
6 changed files with 60 additions and 13 deletions

File diff suppressed because one or more lines are too long

View file

@ -588,9 +588,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
// Add a handler for "Add sections" link to ask for a number of sections to add.
str.get_string('numberweeks').done(function(strNumberSections) {
var trigger = $(SELECTOR.ADDSECTIONS),
modalTitle = trigger.attr('data-add-sections');
modalTitle = trigger.attr('data-add-sections'),
newSections = trigger.attr('new-sections');
var modalBody = $('<div><label for="add_section_numsections"></label> ' +
'<input id="add_section_numsections" type="number" min="1" value="1"></div>');
'<input id="add_section_numsections" type="number" min="1" max="' + newSections + '" value="1"></div>');
modalBody.find('label').html(strNumberSections);
ModalFactory.create({
title: modalTitle,