Commit 36102596 authored by Eloy Lafuente's avatar Eloy Lafuente
Browse files

Merge branch 'MDL-57604-master' of git://github.com/danpoltawski/moodle

parents 2156bb45 76bab368
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -35,12 +35,7 @@ define(['core/ajax', 'jquery', 'core/templates'], function(ajax, $, templates) {
* @return {Array}
*/
processResults: function(selector, data) {
var results = [];
var i = 0;
for (i = 0; i < data.length; i++) {
results[i] = {value: data[i].id, label: data[i].label};
}
return results;
return data;
},
/**
......@@ -62,12 +57,10 @@ define(['core/ajax', 'jquery', 'core/templates'], function(ajax, $, templates) {
filterstrings[$(element).attr('name')] = $(element).prop('checked');
});
var promise = ajax.call([{
ajax.call([{
methodname: 'mod_assign_list_participants',
args: {assignid: assignmentid, groupid: groupid, filter: query, limit: 30, includeenrolments: false}
}]);
promise[0].then(function(results) {
}])[0].then(function(results) {
var promises = [];
var identityfields = $('[data-showuseridentity]').data('showuseridentity').split(',');
......@@ -94,23 +87,18 @@ define(['core/ajax', 'jquery', 'core/templates'], function(ajax, $, templates) {
}
});
ctx.identity = identity.join(', ');
promises.push(templates.render('mod_assign/list_participant_user_summary', ctx));
promises.push(templates.render('mod_assign/list_participant_user_summary', ctx).then(function(html) {
return {value: user.id, label: html};
}));
}
});
// When all the templates have been rendered, call the success handler.
$.when.apply($.when, promises).then(function() {
var args = arguments,
i = 0;
$.each(results, function(index, user) {
user.label = args[i];
i++;
});
success(results);
});
}, failure);
// Do the dance for $.when()
return $.when.apply($, promises);
}).then(function() {
// Undo the $.when() dance from arguments object into an array..
var users = Array.prototype.slice.call(arguments);
success(users);
}).catch(failure);
}
};
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment