Skip to content

Commit

Permalink
MDL-78288 core_course: Hide access restrictions textarea till ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Amaia Anabitarte committed Jul 12, 2023
1 parent 6c1471c commit 841d552
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
},

/**
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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');
},

/**
Expand Down
4 changes: 4 additions & 0 deletions availability/yui/src/form/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
},

/**
Expand Down
4 changes: 3 additions & 1 deletion course/editsection_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ function definition() {
// 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');
Expand Down
5 changes: 4 additions & 1 deletion course/moodleform_mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,10 @@ protected function standard_coursemodule_elements() {
// 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);
Expand Down

0 comments on commit 841d552

Please sign in to comment.