You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.1 KiB
31 lines
1.1 KiB
YUI.add('moodle-course-formatchooser', function (Y, NAME) {
|
|
|
|
var FORMATCHOOSER = function() {
|
|
FORMATCHOOSER.superclass.constructor.apply(this, arguments);
|
|
};
|
|
|
|
Y.extend(FORMATCHOOSER, Y.Base, {
|
|
initializer: function(params) {
|
|
if (params && params.formid) {
|
|
var updatebut = Y.one('#' + params.formid + ' #id_updatecourseformat');
|
|
var formatselect = Y.one('#' + params.formid + ' #id_format');
|
|
var ancestor = updatebut.ancestor('fieldset');
|
|
var action = Y.one('form.mform').get('action');
|
|
if (updatebut && formatselect) {
|
|
updatebut.setStyle('display', 'none');
|
|
formatselect.on('change', function() {
|
|
Y.one('form.mform').set('action', action + '#' + ancestor.get('id'));
|
|
updatebut.simulate('click');
|
|
});
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
M.course = M.course || {};
|
|
M.course.init_formatchooser = function(params) {
|
|
return new FORMATCHOOSER(params);
|
|
};
|
|
|
|
|
|
}, '@VERSION@', {"requires": ["base", "node", "node-event-simulate"]});
|
|
|