mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-33640 - change $templatesinitialized to an array; improve naming and automate use of template
* $templatesinitialized is now an array, so that subsequent calls to initialise_filepicker which request different repositories will include those (and only those) templates which it requires but have not yet been included * The get_template method has also been renamed to get_upload_template (and the template to "uploadform_" followed by the repository type), since it only applies to upload forms * If a plugin provides a get_upload_template method, the template it returns will now automatically be used instead of the standard uploadform template when generating an upload form
This commit is contained in:
parent
013cf2878c
commit
ec3eaa2c38
2 changed files with 12 additions and 8 deletions
|
@ -1618,8 +1618,9 @@ M.core_filepicker.init = function(Y, options) {
|
|||
var client_id = this.options.client_id;
|
||||
var id = data.upload.id+'_'+client_id;
|
||||
var content = this.fpnode.one('.fp-content');
|
||||
var template = data.template || 'uploadform';
|
||||
content.setContent(M.core_filepicker.templates[template]);
|
||||
var template_name = 'uploadform_'+this.options.repositories[data.repo_id].type;
|
||||
var template = M.core_filepicker.templates[template_name] || M.core_filepicker.templates['uploadform'];
|
||||
content.setContent(template);
|
||||
|
||||
content.all('.fp-file,.fp-saveas,.fp-setauthor,.fp-setlicense').each(function (node) {
|
||||
node.all('label').set('for', node.one('input,select').generateID());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue