Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

/**
 * Module to open user competency plan in popup
 *
 * @module     tool_lp/user_competency_plan_popup
 * @copyright  2016 Issam Taboubi <issam.taboubi@umontreal.ca>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define("tool_lp/user_competency_plan_popup",["jquery","core/notification","core/str","core/ajax","core/templates","tool_lp/dialogue"],(function($,notification,str,ajax,templates,Dialogue){var UserCompetencyPopup=function(regionSelector,userCompetencySelector,planId){this._regionSelector=regionSelector,this._userCompetencySelector=userCompetencySelector,this._planId=planId,$(this._regionSelector).on("click",this._userCompetencySelector,this._handleClick.bind(this))};return UserCompetencyPopup.prototype._handleClick=function(e){e.preventDefault();var tr=$(e.target).closest("tr"),competencyId=$(tr).data("competencyid"),userId=$(tr).data("userid"),planId=this._planId;ajax.call([{methodname:"tool_lp_data_for_user_competency_summary_in_plan",args:{competencyid:competencyId,planid:planId},done:this._contextLoaded.bind(this),fail:notification.exception}])[0].then((function(result){var eventMethodName="core_competency_user_competency_viewed_in_plan";return result.plan.iscompleted&&(eventMethodName="core_competency_user_competency_plan_viewed"),ajax.call([{methodname:eventMethodName,args:{competencyid:competencyId,userid:userId,planid:planId}}])[0]})).catch(notification.exception)},UserCompetencyPopup.prototype._contextLoaded=function(context){var self=this;templates.render("tool_lp/user_competency_summary_in_plan",context).done((function(html,js){str.get_string("usercompetencysummary","report_competency").done((function(title){new Dialogue(title,html,templates.runTemplateJS.bind(templates,js),self._refresh.bind(self),!0)})).fail(notification.exception)})).fail(notification.exception)},UserCompetencyPopup.prototype._refresh=function(){var planId=this._planId;ajax.call([{methodname:"tool_lp_data_for_plan_page",args:{planid:planId},done:this._pageContextLoaded.bind(this),fail:notification.exception}])},UserCompetencyPopup.prototype._pageContextLoaded=function(context){var self=this;templates.render("tool_lp/plan_page",context).done((function(html,js){templates.replaceNode(self._regionSelector,html,js)})).fail(notification.exception)},UserCompetencyPopup.prototype._regionSelector=null,UserCompetencyPopup.prototype._userCompetencySelector=null,UserCompetencyPopup.prototype._planId=null,UserCompetencyPopup}));

//# sourceMappingURL=user_competency_plan_popup.min.js.map