%PDF- %PDF-
Direktori : /home/vacivi36/ava/admin/tool/lp/amd/build/ |
Current File : /home/vacivi36/ava/admin/tool/lp/amd/build/form-cohort-selector.min.js |
/** * Cohort selector module. * * @module tool_lp/form-cohort-selector * @copyright 2015 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("tool_lp/form-cohort-selector",["jquery","core/ajax","core/templates"],(function($,Ajax,Templates){return{processResults:function(selector,results){var cohorts=[];return $.each(results,(function(index,cohort){cohorts.push({value:cohort.id,label:cohort._label})})),cohorts},transport:function(selector,query,success,failure){var contextid=parseInt($(selector).data("contextid"),10),includes=$(selector).data("includes");Ajax.call([{methodname:"tool_lp_search_cohorts",args:{query:query,context:{contextid:contextid},includes:includes}}])[0].then((function(results){var promises=[],i=0;return $.each(results.cohorts,(function(index,cohort){promises.push(Templates.render("tool_lp/form-cohort-selector-suggestion",cohort))})),$.when.apply($.when,promises).then((function(){var args=arguments;$.each(results.cohorts,(function(index,cohort){cohort._label=args[i],i++})),success(results.cohorts)}))})).catch(failure)}}})); //# sourceMappingURL=form-cohort-selector.min.js.map