MDL-78288 core_course: Hide access restrictions textarea till ready

This commit is contained in:
Amaia Anabitarte 2023-07-03 18:12:44 +02:00
parent 6c1471c755
commit 841d552942
6 changed files with 23 additions and 6 deletions

View File

@ -145,6 +145,10 @@ M.core_availability.form = {
}
this.updateRestrictByGroup();
}
// Everything is ready. Make sure the div is visible.
this.parent = Y.one('#fitem_id_availabilityconditionsjson');
this.parent.removeClass('d-none');
},
/**

File diff suppressed because one or more lines are too long

View File

@ -145,6 +145,10 @@ M.core_availability.form = {
}
this.updateRestrictByGroup();
}
// Everything is ready. Make sure the div is visible.
this.parent = Y.one('#fitem_id_availabilityconditionsjson');
this.parent.removeClass('d-none');
},
/**

View File

@ -143,6 +143,10 @@ M.core_availability.form = {
}
this.updateRestrictByGroup();
}
// Everything is ready. Make sure the div is visible.
this.parent = Y.one('#fitem_id_availabilityconditionsjson');
this.parent.removeClass('d-none');
},
/**

View File

@ -57,7 +57,9 @@ class editsection_form extends moodleform {
// interaction is all implemented in JavaScript. The field is named
// availabilityconditionsjson for consistency with moodleform_mod.
$mform->addElement('textarea', 'availabilityconditionsjson',
get_string('accessrestrictions', 'availability'));
get_string('accessrestrictions', 'availability'),
['class' => 'd-none']
);
}
$mform->_registerCancelButton('cancel');

View File

@ -712,7 +712,10 @@ abstract class moodleform_mod extends moodleform {
// conflicts with fields in existing modules (such as assign).
// So it uses a long name that will not conflict.
$mform->addElement('textarea', 'availabilityconditionsjson',
get_string('accessrestrictions', 'availability'));
get_string('accessrestrictions', 'availability'),
['class' => 'd-none']
);
// The _cm variable may not be a proper cm_info, so get one from modinfo.
if ($this->_cm) {
$modinfo = get_fast_modinfo($COURSE);