MDL-53494 tool_lp: Set correct competency and user ID attributes

Sets the correct competency and user ID data attributes for the list of
user competencies in the plan.
This commit is contained in:
Jun Pataleta
2016-04-29 12:18:04 +01:00
committed by Dan Poltawski
parent eb98b1395d
commit 0bb7552429
3 changed files with 4 additions and 16 deletions
+1 -1
View File
@@ -1 +1 @@
define(["jquery","core/notification","core/str","core/ajax","core/templates","tool_lp/dialogue"],function(a,b,c,d,e,f){var g=function(b,c,d){this._regionSelector=b,this._userCompetencySelector=c,this._planId=d,a(this._regionSelector).on("click",this._userCompetencySelector,this._handleClick.bind(this))};return g.prototype._handleClick=function(c){c.preventDefault();var e=a(c.target).closest("tr"),f=a(e).data("competencyid"),g=a(e).data("userid"),h=this._planId,i=d.call([{methodname:"tool_lp_data_for_user_competency_summary_in_plan",args:{competencyid:f,planid:h},done:this._contextLoaded.bind(this),fail:b.exception}]);i[0].then(function(a){var c="core_competency_user_competency_viewed_in_plan";a.plan.iscompleted&&(c="core_competency_user_competency_plan_viewed"),d.call([{methodname:c,args:{competencyid:f,userid:g,planid:h},fail:b.exception}])})},g.prototype._contextLoaded=function(a){var d=this;e.render("tool_lp/user_competency_summary_in_plan",a).done(function(g,h){c.get_string("usercompetencysummary","report_competency").done(function(b){var c=null;a.plan.iscomplete||(c=e.runTemplateJS.bind(e,h)),new f(b,g,c,d._refresh.bind(d),!0)}).fail(b.exception)}).fail(b.exception)},g.prototype._refresh=function(){var a=this._planId;d.call([{methodname:"tool_lp_data_for_plan_page",args:{planid:a},done:this._pageContextLoaded.bind(this),fail:b.exception}])},g.prototype._pageContextLoaded=function(a){var c=this;e.render("tool_lp/plan_page",a).done(function(a,b){e.replaceNode(c._regionSelector,a,b)}).fail(b.exception)},g.prototype._regionSelector=null,g.prototype._userCompetencySelector=null,g.prototype._planId=null,g});
define(["jquery","core/notification","core/str","core/ajax","core/templates","tool_lp/dialogue"],function(a,b,c,d,e,f){var g=function(b,c,d){this._regionSelector=b,this._userCompetencySelector=c,this._planId=d,a(this._regionSelector).on("click",this._userCompetencySelector,this._handleClick.bind(this))};return g.prototype._handleClick=function(c){c.preventDefault();var e=a(c.target).closest("tr"),f=a(e).data("competencyid"),g=a(e).data("userid"),h=this._planId,i=d.call([{methodname:"tool_lp_data_for_user_competency_summary_in_plan",args:{competencyid:f,planid:h},done:this._contextLoaded.bind(this),fail:b.exception}]);i[0].then(function(a){var c="core_competency_user_competency_viewed_in_plan";a.plan.iscompleted&&(c="core_competency_user_competency_plan_viewed"),d.call([{methodname:c,args:{competencyid:f,userid:g,planid:h},fail:b.exception}])})},g.prototype._contextLoaded=function(a){var d=this;e.render("tool_lp/user_competency_summary_in_plan",a).done(function(a,g){c.get_string("usercompetencysummary","report_competency").done(function(b){new f(b,a,e.runTemplateJS.bind(e,g),d._refresh.bind(d),!0)}).fail(b.exception)}).fail(b.exception)},g.prototype._refresh=function(){var a=this._planId;d.call([{methodname:"tool_lp_data_for_plan_page",args:{planid:a},done:this._pageContextLoaded.bind(this),fail:b.exception}])},g.prototype._pageContextLoaded=function(a){var c=this;e.render("tool_lp/plan_page",a).done(function(a,b){e.replaceNode(c._regionSelector,a,b)}).fail(b.exception)},g.prototype._regionSelector=null,g.prototype._userCompetencySelector=null,g.prototype._planId=null,g});
@@ -84,12 +84,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/templates'
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) {
var afterShow = null;
// Run afterShow script if plan has not yet been completed.
if (!context.plan.iscomplete) {
afterShow = templates.runTemplateJS.bind(templates, js);
}
(new Dialogue(title, html, afterShow, self._refresh.bind(self), true));
(new Dialogue(title, html, templates.runTemplateJS.bind(templates, js), self._refresh.bind(self), true));
}).fail(notification.exception);
}).fail(notification.exception);
};
+2 -9
View File
@@ -128,15 +128,8 @@
<tbody class="drag-parentnode">
{{#competencies}}
<tr class="drag-samenode" data-node="user-competency" data-id="{{competency.id}}"
{{#plan.iscompleted}}
data-competencyid="{{usercompetencyplan.id}}"
data-userid="{{usercompetencyplan.userid}}"
{{/plan.iscompleted}}
{{^plan.iscompleted}}
data-competencyid="{{usercompetency.competencyid}}"
data-userid="{{usercompetency.userid}}"
{{/plan.iscompleted}}
>
data-competencyid="{{competency.id}}"
data-userid="{{plan.userid}}">
<td>
{{#plan.canbeedited}}
<span class="drag-handlecontainer pull-left"></span>