MDL-52861 tool_lp: The grading dialogue should show who is being graded

This commit is contained in:
Issam Taboubi 2016-02-12 17:43:42 -05:00 committed by Frederic Massart
parent af3fa58f3c
commit e1b93e42d8
5 changed files with 24 additions and 4 deletions

View File

@ -1 +1 @@
define(["jquery","core/notification","core/ajax","core/templates","core/log"],function(a,b,c,d,e){var f=function(a,b,c,d,e){this._rootElement=a,this._competencyId=b,this._userId=c,this._planId=d,this._courseId=e,this._valid=!0,this._planId?(this._methodName="tool_lp_data_for_user_competency_summary_in_plan",this._args={competencyid:this._competencyId,planid:this._planId},this._templateName="tool_lp/user_competency_summary_in_plan"):this._courseId?(this._methodName="tool_lp_data_for_user_competency_summary_in_course",this._args={userid:this._userId,competencyid:this._competencyId,courseid:this._courseId},this._templateName="tool_lp/user_competency_summary_in_course"):(this._methodName="tool_lp_data_for_user_competency_summary",this._args={userid:this._userId,competencyid:this._competencyId},this._templateName="tool_lp/user_competency_summary")};return f.prototype.reload=function(){var a=this,e=[];this._valid&&(e=c.call([{methodname:this._methodName,args:this._args}]),e[0].done(function(c){d.render(a._templateName,c).done(function(b,c){d.replaceNode(a._rootElement,b,c)}).fail(b.exception)}).fail(b.exception))},f.prototype._rootElement=null,f.prototype._courseId=null,f.prototype._valid=null,f.prototype._planId=null,f.prototype._competencyId=null,f.prototype._userId=null,f.prototype._methodName=null,f.prototype._args=null,f.prototype._templateName=null,f});
define(["jquery","core/notification","core/ajax","core/templates","core/log"],function(a,b,c,d,e){var f=function(a,b,c,d,e,f){this._rootElement=a,this._competencyId=b,this._userId=c,this._planId=d,this._courseId=e,this._valid=!0,this._displayuser="undefined"!=typeof f?f:!1,this._planId?(this._methodName="tool_lp_data_for_user_competency_summary_in_plan",this._args={competencyid:this._competencyId,planid:this._planId},this._templateName="tool_lp/user_competency_summary_in_plan"):this._courseId?(this._methodName="tool_lp_data_for_user_competency_summary_in_course",this._args={userid:this._userId,competencyid:this._competencyId,courseid:this._courseId},this._templateName="tool_lp/user_competency_summary_in_course"):(this._methodName="tool_lp_data_for_user_competency_summary",this._args={userid:this._userId,competencyid:this._competencyId},this._templateName="tool_lp/user_competency_summary")};return f.prototype.reload=function(){var a=this,e=[];this._valid&&(e=c.call([{methodname:this._methodName,args:this._args}]),e[0].done(function(c){a._displayuser&&(c.displayuser=!0),d.render(a._templateName,c).done(function(b,c){d.replaceNode(a._rootElement,b,c)}).fail(b.exception)}).fail(b.exception))},f.prototype._rootElement=null,f.prototype._courseId=null,f.prototype._valid=null,f.prototype._planId=null,f.prototype._competencyId=null,f.prototype._userId=null,f.prototype._methodName=null,f.prototype._args=null,f.prototype._templateName=null,f.prototype._displayuser=!1,f});

View File

@ -31,14 +31,16 @@ define(['jquery', 'core/notification', 'core/ajax', 'core/templates', 'core/log'
* @param {Number} The id of the user.
* @param {Number} The id of the plan.
* @param {Number} The id of the course.
* @param {Boolean} If we should display the user info.
*/
var Info = function(rootElement, competencyId, userId, planId, courseId) {
var Info = function(rootElement, competencyId, userId, planId, courseId, displayuser) {
this._rootElement = rootElement;
this._competencyId = competencyId;
this._userId = userId;
this._planId = planId;
this._courseId = courseId;
this._valid = true;
this._displayuser = (typeof displayuser !== 'undefined') ? displayuser : false;
if (this._planId) {
this._methodName = 'tool_lp_data_for_user_competency_summary_in_plan';
@ -74,6 +76,10 @@ define(['jquery', 'core/notification', 'core/ajax', 'core/templates', 'core/log'
}]);
promises[0].done(function(context) {
// Check if we should also the user info.
if (self._displayuser) {
context.displayuser = true;
}
templates.render(self._templateName, context).done(function(html, js) {
templates.replaceNode(self._rootElement, html, js);
}).fail(notification.exception);
@ -98,6 +104,8 @@ define(['jquery', 'core/notification', 'core/ajax', 'core/templates', 'core/log'
Info.prototype._args = null;
/** @type {String} The template to reload the fragment. */
Info.prototype._templateName = null;
/** @type {Boolean} If we should display the user info? */
Info.prototype._displayuser = false;
return /** @alias module:tool_lp/user_competency_info */ Info;

View File

@ -60,6 +60,14 @@
</p>
</dd>
{{#usercompetency}}
{{#displayuser}}
{{#user}}
<dt>{{#str}}user{{/str}}</dt>
<dd>
{{>tool_lp/user_summary}}
</dd>
{{/user}}
{{/displayuser}}
<dt>{{#str}}reviewstatus, tool_lp{{/str}}</dt>
<dd data-region="user-competency-status">{{statusname}}
@ -85,7 +93,9 @@
var inlineGrader = new mod('#rate_{{uniqid}}', scaleConfig, '{{competency.competency.id}}', '{{user.id}}', '', '{{course.id}}', '{{#str}}chooserating, tool_lp{{/str}}', {{cangrade}}, {{cansuggest}});
var competencyElement = $('[data-region-id="{{uniqid}}"]');
var infoReloader = new info(competencyElement, '{{competency.competency.id}}', '{{user.id}}', '', '{{course.id}}');
var displayuser = ('{{displayuser}}' == 'true') ? true : false;
var infoReloader = new info(competencyElement, '{{competency.competency.id}}', '{{user.id}}', '', '{{course.id}}', displayuser);
inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
});

View File

@ -1 +1 @@
define(["jquery","core/notification","core/str","core/ajax","core/log","core/templates","tool_lp/dialogue"],function(a,b,c,d,e,f,g){var h=function(b,c){this._regionSelector=b,this._userCompetencySelector=c,a(this._regionSelector).on("click",this._userCompetencySelector,this._handleClick.bind(this))};return h.prototype._handleClick=function(c){var f=a(c.target).closest(this._userCompetencySelector),g=a(f).data("competencyid"),h=a(f).data("courseid"),i=a(f).data("userid");e.debug("Clicked on cell: competencyId="+g+", courseId="+h+", userId="+i),d.call([{methodname:"tool_lp_data_for_user_competency_summary_in_course",args:{userid:i,competencyid:g,courseid:h},done:this._contextLoaded.bind(this),fail:b.exception}])},h.prototype._contextLoaded=function(a){var d=this;f.render("tool_lp/user_competency_summary_in_course",a).done(function(a,e){c.get_string("usercompetencysummary","report_competency").done(function(b){new g(b,a,f.runTemplateJS.bind(f,e),d._refresh.bind(d),!0)}).fail(b.exception)}).fail(b.exception)},h.prototype._refresh=function(){var c=a(this._regionSelector),e=c.data("courseid"),f=c.data("groupid"),g=c.data("userid"),h=c.data("onlyactive");d.call([{methodname:"report_competency_data_for_report",args:{courseid:e,groupid:f,userid:g,onlyactive:h},done:this._pageContextLoaded.bind(this),fail:b.exception}])},h.prototype._pageContextLoaded=function(a){var c=this;f.render("report_competency/report",a).done(function(a,b){f.replaceNode(c._regionSelector,a,b)}).fail(b.exception)},h.prototype._regionSelector=null,h.prototype._userCompetencySelector=null,h});
define(["jquery","core/notification","core/str","core/ajax","core/log","core/templates","tool_lp/dialogue"],function(a,b,c,d,e,f,g){var h=function(b,c){this._regionSelector=b,this._userCompetencySelector=c,a(this._regionSelector).on("click",this._userCompetencySelector,this._handleClick.bind(this))};return h.prototype._handleClick=function(c){var f=a(c.target).closest(this._userCompetencySelector),g=a(f).data("competencyid"),h=a(f).data("courseid"),i=a(f).data("userid");e.debug("Clicked on cell: competencyId="+g+", courseId="+h+", userId="+i),d.call([{methodname:"tool_lp_data_for_user_competency_summary_in_course",args:{userid:i,competencyid:g,courseid:h},done:this._contextLoaded.bind(this),fail:b.exception}])},h.prototype._contextLoaded=function(a){var d=this;a.displayuser=!0,f.render("tool_lp/user_competency_summary_in_course",a).done(function(a,e){c.get_string("usercompetencysummary","report_competency").done(function(b){new g(b,a,f.runTemplateJS.bind(f,e),d._refresh.bind(d),!0)}).fail(b.exception)}).fail(b.exception)},h.prototype._refresh=function(){var c=a(this._regionSelector),e=c.data("courseid"),f=c.data("userid");d.call([{methodname:"report_competency_data_for_report",args:{courseid:e,userid:f},done:this._pageContextLoaded.bind(this),fail:b.exception}])},h.prototype._pageContextLoaded=function(a){var c=this;f.render("report_competency/report",a).done(function(a,b){f.replaceNode(c._regionSelector,a,b)}).fail(b.exception)},h.prototype._regionSelector=null,h.prototype._userCompetencySelector=null,h});

View File

@ -67,6 +67,8 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'cor
*/
GradingPopup.prototype._contextLoaded = function(context) {
var self = this;
// We have to display user info in popup.
context.displayuser = true;
templates.render('tool_lp/user_competency_summary_in_course', 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), true));