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.
1 line
1.3 KiB
1 line
1.3 KiB
2 years ago
|
define(["jquery","tool_lp/competencypicker","core/ajax","core/notification","core/templates"],function(a,b,c,d,e){var f=null,g=1,h=function(){var b=a('[data-action="competencies"]').val(),f=[],g=0;if(""!=b)for(b=b.split(","),g=0;g<b.length;g++)f[f.length]={methodname:"core_competency_read_competency",args:{id:b[g]}};return a.when.apply(a,c.call(f,!1)).then(function(){var a=0,b=[];for(a=0;a<arguments.length;a++)b[a]=arguments[a];var c={competencies:b};return e.render("tool_lp/form_competency_list",c)}).then(function(b,c){return e.replaceNode(a('[data-region="competencies"]'),b,c),!0}).fail(d.exception),!0},i=function(b){var c,d=a('[data-action="competencies"]').val().split(","),e=[],f=a(b.currentTarget).data("id");for(c=0;c<d.length;c++)d[c]!=f&&(e[e.length]=d[c]);return a('[data-action="competencies"]').val(e.join(",")),h()},j=function(){var c=a('[data-action="competencies"]').val().split(",");f||(f=new b(g,(!1),"parents",(!0)),f.on("save",function(b,c){var d=a('[data-action="competencies"]').val(),e=c.competencyIds;""!=d&&(e=e.concat(d.split(",")));var f=e.join(",");return a('[data-action="competencies"]').val(f),h()})),f.setDisallowedCompetencyIDs(c),f.display()};return{init:function(b){g=b,h(),a('[data-action="select-competencies"]').on("click",j),a("body").on("click",'[data-action="deselect-competency"]',i)}}});
|