mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-66378 competency: Add pending promises to competency chooser
This commit is contained in:
parent
460a0a74c4
commit
dafa2c6aa5
2
admin/tool/lp/amd/build/competencies.min.js
vendored
2
admin/tool/lp/amd/build/competencies.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
||||
define ("tool_lp/course_competency_settings",["jquery","core/notification","tool_lp/dialogue","core/str","core/ajax","core/templates"],function(a,b,c,d,f,g){var h=function(b){a(b).on("click",this.configureSettings.bind(this))};h.prototype._dialogue=null;h.prototype.configureSettings=function(f){var e=a(f.target).closest("a").data("courseid"),h=a(f.target).closest("a").data("pushratingstouserplans");f.preventDefault();g.render("tool_lp/course_competency_settings",{courseid:e,settings:{pushratingstouserplans:h}}).done(function(a){d.get_string("configurecoursecompetencysettings","tool_lp").done(function(b){this._dialogue=new c(b,a,this.addListeners.bind(this))}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)};h.prototype.addListeners=function(){var a=this._find("[data-action=\"save\"]");a.on("click",this.saveSettings.bind(this));var b=this._find("[data-action=\"cancel\"]");b.on("click",this.cancelChanges.bind(this))};h.prototype.cancelChanges=function(a){a.preventDefault();this._dialogue.close()};h.prototype._find=function(b){return a("[data-region=\"coursecompetencysettings\"]").find(b)};h.prototype.saveSettings=function(a){a.preventDefault();var c=this._find("input[name=\"pushratingstouserplans\"]:checked").val(),d=this._find("input[name=\"courseid\"]").val();f.call([{methodname:"core_competency_update_course_competency_settings",args:{courseid:d,settings:{pushratingstouserplans:c}}}])[0].done(function(){this.refreshCourseCompetenciesPage()}.bind(this)).fail(b.exception)};h.prototype.refreshCourseCompetenciesPage=function(){var c=this._find("input[name=\"courseid\"]").val();f.call([{methodname:"tool_lp_data_for_course_competencies_page",args:{courseid:c,moduleid:0}}])[0].done(function(c){g.render("tool_lp/course_competencies_page",c).done(function(b,c){a("[data-region=\"coursecompetenciespage\"]").replaceWith(b);g.runTemplateJS(c);this._dialogue.close()}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)};return h});
|
||||
define ("tool_lp/course_competency_settings",["jquery","core/notification","tool_lp/dialogue","core/str","core/ajax","core/templates","core/pending"],function(a,b,c,d,f,g,h){var i=function(b){a(b).on("click",this.configureSettings.bind(this))};i.prototype._dialogue=null;i.prototype.configureSettings=function(f){var e=new h,i=a(f.target).closest("a").data("courseid"),j=a(f.target).closest("a").data("pushratingstouserplans");f.preventDefault();a.when(d.get_string("configurecoursecompetencysettings","tool_lp"),g.render("tool_lp/course_competency_settings",{courseid:i,settings:{pushratingstouserplans:j}})).then(function(a,b){this._dialogue=new c(a,b[0],this.addListeners.bind(this));return this._dialogue}.bind(this)).then(e.resolve).catch(b.exception)};i.prototype.addListeners=function(){var a=this._find("[data-action=\"save\"]");a.on("click",this.saveSettings.bind(this));var b=this._find("[data-action=\"cancel\"]");b.on("click",this.cancelChanges.bind(this))};i.prototype.cancelChanges=function(a){a.preventDefault();this._dialogue.close()};i.prototype._find=function(b){return a("[data-region=\"coursecompetencysettings\"]").find(b)};i.prototype.saveSettings=function(a){var c=new h;a.preventDefault();var d=this._find("input[name=\"pushratingstouserplans\"]:checked").val(),e=this._find("input[name=\"courseid\"]").val();f.call([{methodname:"core_competency_update_course_competency_settings",args:{courseid:e,settings:{pushratingstouserplans:d}}}])[0].then(function(){return this.refreshCourseCompetenciesPage()}.bind(this)).then(c.resolve).catch(b.exception)};i.prototype.refreshCourseCompetenciesPage=function(){var c=this._find("input[name=\"courseid\"]").val(),d=new h;f.call([{methodname:"tool_lp_data_for_course_competencies_page",args:{courseid:c,moduleid:0}}])[0].then(function(a){return g.render("tool_lp/course_competencies_page",a)}).then(function(b,c){g.replaceNode(a("[data-region=\"coursecompetenciespage\"]"),b,c);this._dialogue.close()}.bind(this)).then(d.resolve).catch(b.exception)};return i});
|
||||
//# sourceMappingURL=course_competency_settings.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
||||
define ("tool_lp/grade_dialogue",["jquery","core/notification","core/templates","tool_lp/dialogue","tool_lp/event_base","core/str"],function(a,b,c,d,e,f){var g=function(a){e.prototype.constructor.apply(this,[]);this._ratingOptions=a};g.prototype=Object.create(e.prototype);g.prototype._popup=null;g.prototype._ratingOptions=null;g.prototype._afterRender=function(){var b=this._find("[data-action=\"rate\"]"),c=this._find("[name=\"rating\"]"),d=this._find("[name=\"comment\"]");this._find("[data-action=\"cancel\"]").click(function(a){a.preventDefault();this._trigger("cancelled");this.close()}.bind(this));c.change(function(){var c=a(this);if(!c.val()){b.prop("disabled",!0)}else{b.prop("disabled",!1)}}).change();b.click(function(a){a.preventDefault();var b=c.val();if(!b){return}this._trigger("rated",{rating:b,note:d.val()});this.close()}.bind(this))};g.prototype.close=function(){this._popup.close();this._popup=null};g.prototype.display=function(){return this._render().then(function(a){return f.get_string("rate","tool_lp").then(function(b){this._popup=new d(b,a,this._afterRender.bind(this))}.bind(this))}.bind(this)).fail(b.exception)};g.prototype._find=function(b){return a(this._popup.getContent()).find(b)};g.prototype._render=function(){var a={cangrade:this._canGrade,ratings:this._ratingOptions};return c.render("tool_lp/competency_grader",a)};return g});
|
||||
define ("tool_lp/grade_dialogue",["jquery","core/notification","core/templates","tool_lp/dialogue","tool_lp/event_base","core/str"],function(a,b,c,d,e,f){var g=function(a){e.prototype.constructor.apply(this,[]);this._ratingOptions=a};g.prototype=Object.create(e.prototype);g.prototype._popup=null;g.prototype._ratingOptions=null;g.prototype._afterRender=function(){var b=this._find("[data-action=\"rate\"]"),c=this._find("[name=\"rating\"]"),d=this._find("[name=\"comment\"]");this._find("[data-action=\"cancel\"]").click(function(a){a.preventDefault();this._trigger("cancelled");this.close()}.bind(this));c.change(function(){var c=a(this);if(!c.val()){b.prop("disabled",!0)}else{b.prop("disabled",!1)}}).change();b.click(function(a){a.preventDefault();var b=c.val();if(!b){return}this._trigger("rated",{rating:b,note:d.val()});this.close()}.bind(this))};g.prototype.close=function(){this._popup.close();this._popup=null};g.prototype.display=function(){return a.when(f.get_string("rate","tool_lp"),this._render()).then(function(a,b){this._popup=new d(a,b[0],this._afterRender.bind(this));return this._popup}.bind(this)).catch(b.exception)};g.prototype._find=function(b){return a(this._popup.getContent()).find(b)};g.prototype._render=function(){var a={cangrade:this._canGrade,ratings:this._ratingOptions};return c.render("tool_lp/competency_grader",a)};return g});
|
||||
//# sourceMappingURL=grade_dialogue.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
||||
define ("tool_lp/grade_user_competency_inline",["jquery","core/notification","core/ajax","core/log","tool_lp/grade_dialogue","tool_lp/event_base","tool_lp/scalevalues"],function(a,b,c,d,e,f,g){var h=function(b,c,d,e,g,h,i){f.prototype.constructor.apply(this,[]);var j=a(b);if(!j.length){throw new Error("Could not find the trigger")}this._scaleId=c;this._competencyId=d;this._userId=e;this._planId=g;this._courseId=h;this._chooseStr=i;this._setUp();j.click(function(a){a.preventDefault();this._dialogue.display()}.bind(this));if(this._planId){this._methodName="core_competency_grade_competency_in_plan";this._args={competencyid:this._competencyId,planid:this._planId}}else if(this._courseId){this._methodName="core_competency_grade_competency_in_course";this._args={competencyid:this._competencyId,courseid:this._courseId,userid:this._userId}}else{this._methodName="core_competency_grade_competency";this._args={userid:this._userId,competencyid:this._competencyId}}};h.prototype=Object.create(f.prototype);h.prototype._setUp=function(){var a=[],d=this,f=g.get_values(d._scaleId);f.done(function(f){a.push({value:"",name:d._chooseStr});for(var g=0,h;g<f.length;g++){h=f[g];a.push({value:h.id,name:h.name})}d._dialogue=new e(a);d._dialogue.on("rated",function(a,e){var f=d._args;f.grade=e.rating;f.note=e.note;c.call([{methodname:d._methodName,args:f,done:function done(a){d._trigger("competencyupdated",{args:f,evidence:a})},fail:b.exception}])})}).fail(b.exception)};h.prototype._scaleId=null;h.prototype._competencyId=null;h.prototype._userId=null;h.prototype._planId=null;h.prototype._courseId=null;h.prototype._chooseStr=null;h.prototype._dialogue=null;return h});
|
||||
define ("tool_lp/grade_user_competency_inline",["jquery","core/notification","core/ajax","core/log","tool_lp/grade_dialogue","tool_lp/event_base","tool_lp/scalevalues"],function(a,b,c,d,e,f,g){var h=function(b,c,d,e,g,h,i){f.prototype.constructor.apply(this,[]);var j=a(b);if(!j.length){throw new Error("Could not find the trigger")}this._scaleId=c;this._competencyId=d;this._userId=e;this._planId=g;this._courseId=h;this._chooseStr=i;this._setUp();j.click(function(a){a.preventDefault();this._dialogue.display()}.bind(this));if(this._planId){this._methodName="core_competency_grade_competency_in_plan";this._args={competencyid:this._competencyId,planid:this._planId}}else if(this._courseId){this._methodName="core_competency_grade_competency_in_course";this._args={competencyid:this._competencyId,courseid:this._courseId,userid:this._userId}}else{this._methodName="core_competency_grade_competency";this._args={userid:this._userId,competencyid:this._competencyId}}};h.prototype=Object.create(f.prototype);h.prototype._setUp=function(){var a=[],d=this,f=g.get_values(d._scaleId);f.then(function(b){a.push({value:"",name:d._chooseStr});for(var c=0,e;c<b.length;c++){e=b[c];a.push({value:e.id,name:e.name})}return a}).then(function(a){return new e(a)}).then(function(a){a.on("rated",function(a,e){var f=d._args;f.grade=e.rating;f.note=e.note;c.call([{methodname:d._methodName,args:f,done:function done(a){d._trigger("competencyupdated",{args:f,evidence:a})},fail:b.exception}])});return a}).then(function(a){d._dialogue=a}).fail(b.exception)};h.prototype._scaleId=null;h.prototype._competencyId=null;h.prototype._userId=null;h.prototype._planId=null;h.prototype._courseId=null;h.prototype._chooseStr=null;h.prototype._dialogue=null;return h});
|
||||
//# sourceMappingURL=grade_user_competency_inline.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
@ -27,8 +27,9 @@ define(['jquery',
|
||||
'core/templates',
|
||||
'core/str',
|
||||
'tool_lp/competencypicker',
|
||||
'tool_lp/dragdrop-reorder'],
|
||||
function($, notification, ajax, templates, str, Picker, dragdrop) {
|
||||
'tool_lp/dragdrop-reorder',
|
||||
'core/pending'],
|
||||
function($, notification, ajax, templates, str, Picker, dragdrop, Pending) {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -117,6 +118,7 @@ define(['jquery',
|
||||
* Pick a competency
|
||||
*
|
||||
* @method pickCompetency
|
||||
* @return {Promise}
|
||||
*/
|
||||
competencies.prototype.pickCompetency = function() {
|
||||
var self = this;
|
||||
@ -132,6 +134,7 @@ define(['jquery',
|
||||
self.pickerInstance = new Picker(self.pageContextId, false, pageContextIncludes);
|
||||
self.pickerInstance.on('save', function(e, data) {
|
||||
var compIds = data.competencyIds;
|
||||
var pendingPromise = new Pending();
|
||||
|
||||
if (self.itemtype === "course") {
|
||||
requests = [];
|
||||
@ -181,17 +184,20 @@ define(['jquery',
|
||||
pagerender = 'tool_lp/plan_page';
|
||||
pageregion = 'plan-page';
|
||||
}
|
||||
ajax.call(requests)[requests.length - 1].then(function(context) {
|
||||
ajax.call(requests)[requests.length - 1]
|
||||
.then(function(context) {
|
||||
return templates.render(pagerender, context);
|
||||
}).then(function(html, js) {
|
||||
$('[data-region="' + pageregion + '"]').replaceWith(html);
|
||||
templates.runTemplateJS(js);
|
||||
})
|
||||
.then(function(html, js) {
|
||||
templates.replaceNode($('[data-region="' + pageregion + '"]'), html, js);
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
})
|
||||
.then(pendingPromise.resolve)
|
||||
.catch(notification.exception);
|
||||
});
|
||||
}
|
||||
|
||||
self.pickerInstance.display();
|
||||
return self.pickerInstance.display();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -302,6 +308,7 @@ define(['jquery',
|
||||
if (localthis.itemtype == 'course') {
|
||||
// Course completion rule handling.
|
||||
$('[data-region="coursecompetenciespage"]').on('change', 'select[data-field="ruleoutcome"]', function(e) {
|
||||
var pendingPromise = new Pending();
|
||||
var requests = [];
|
||||
var pagerender = 'tool_lp/course_competencies_page';
|
||||
var pageregion = 'coursecompetenciespage';
|
||||
@ -314,18 +321,24 @@ define(['jquery',
|
||||
args: {courseid: localthis.itemid, moduleid: 0}}
|
||||
]);
|
||||
|
||||
requests[1].done(function(context) {
|
||||
templates.render(pagerender, context).done(function(html, js) {
|
||||
$('[data-region="' + pageregion + '"]').replaceWith(html);
|
||||
templates.runTemplateJS(js);
|
||||
}).fail(notification.exception);
|
||||
}).fail(notification.exception);
|
||||
requests[1].then(function(context) {
|
||||
return templates.render(pagerender, context);
|
||||
})
|
||||
.then(function(html, js) {
|
||||
return templates.replaceNode($('[data-region="' + pageregion + '"]'), html, js);
|
||||
})
|
||||
.then(pendingPromise.resolve)
|
||||
.catch(notification.exception);
|
||||
});
|
||||
}
|
||||
|
||||
$('[data-region="actions"] button').click(function(e) {
|
||||
var pendingPromise = new Pending();
|
||||
e.preventDefault();
|
||||
localthis.pickCompetency();
|
||||
|
||||
localthis.pickCompetency()
|
||||
.then(pendingPromise.resolve)
|
||||
.catch();
|
||||
});
|
||||
$('[data-action="delete-competency-link"]').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
@ -33,8 +33,12 @@ define(['jquery',
|
||||
'tool_lp/menubar',
|
||||
'tool_lp/competencypicker',
|
||||
'tool_lp/competency_outcomes',
|
||||
'tool_lp/competencyruleconfig'],
|
||||
function($, url, templates, notification, str, ajax, dragdrop, Ariatree, Dialogue, menubar, Picker, Outcomes, RuleConfig) {
|
||||
'tool_lp/competencyruleconfig',
|
||||
'core/pending',
|
||||
],
|
||||
function(
|
||||
$, url, templates, notification, str, ajax, dragdrop, Ariatree, Dialogue, menubar, Picker, Outcomes, RuleConfig, Pending
|
||||
) {
|
||||
|
||||
// Private variables and functions.
|
||||
/** @var {Object} treeModel - This is an object representing the nodes in the tree. */
|
||||
@ -412,6 +416,7 @@ define(['jquery',
|
||||
if (!pickerInstance) {
|
||||
pickerInstance = new Picker(pageContextId, relatedTarget.competencyframeworkid);
|
||||
pickerInstance.on('save', function(e, data) {
|
||||
var pendingPromise = new Pending();
|
||||
var compIds = data.competencyIds;
|
||||
|
||||
var calls = [];
|
||||
@ -436,7 +441,9 @@ define(['jquery',
|
||||
templates.runTemplateJS(js);
|
||||
updatedRelatedCompetencies();
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
})
|
||||
.then(pendingPromise.resolve)
|
||||
.catch(notification.exception);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,10 @@ define(['jquery',
|
||||
'core/templates',
|
||||
'tool_lp/dialogue',
|
||||
'core/str',
|
||||
'tool_lp/tree'],
|
||||
function($, Notification, Ajax, Templates, Dialogue, Str, Tree) {
|
||||
'tool_lp/tree',
|
||||
'core/pending'
|
||||
],
|
||||
function($, Notification, Ajax, Templates, Dialogue, Str, Tree, Pending) {
|
||||
|
||||
/**
|
||||
* Competency picker class.
|
||||
@ -157,6 +159,7 @@ define(['jquery',
|
||||
// Add listener for add.
|
||||
self._find('[data-region="competencylinktree"] [data-action="add"]').click(function(e) {
|
||||
e.preventDefault();
|
||||
var pendingPromise = new Pending();
|
||||
if (!self._selectedCompetencies.length) {
|
||||
return;
|
||||
}
|
||||
@ -168,7 +171,10 @@ define(['jquery',
|
||||
self._trigger('save', {competencyId: self._selectedCompetencies[0]});
|
||||
}
|
||||
|
||||
// The dialogue here is a YUI dialogue and doesn't support Promises at all.
|
||||
// However, it is typically synchronous so this shoudl suffice.
|
||||
self.close();
|
||||
pendingPromise.resolve();
|
||||
});
|
||||
|
||||
// The list of selected competencies will be modified while looping (because of the listeners above).
|
||||
|
@ -26,8 +26,10 @@ define(['jquery',
|
||||
'tool_lp/dialogue',
|
||||
'core/str',
|
||||
'core/ajax',
|
||||
'core/templates'],
|
||||
function($, notification, Dialogue, str, ajax, templates) {
|
||||
'core/templates',
|
||||
'core/pending'
|
||||
],
|
||||
function($, notification, Dialogue, str, ajax, templates, Pending) {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -48,6 +50,7 @@ define(['jquery',
|
||||
* @method configureSettings
|
||||
*/
|
||||
settingsMod.prototype.configureSettings = function(e) {
|
||||
var pendingPromise = new Pending();
|
||||
var courseid = $(e.target).closest('a').data('courseid');
|
||||
var currentValue = $(e.target).closest('a').data('pushratingstouserplans');
|
||||
var context = {
|
||||
@ -56,16 +59,21 @@ define(['jquery',
|
||||
};
|
||||
e.preventDefault();
|
||||
|
||||
templates.render('tool_lp/course_competency_settings', context).done(function(html) {
|
||||
str.get_string('configurecoursecompetencysettings', 'tool_lp').done(function(title) {
|
||||
this._dialogue = new Dialogue(
|
||||
title,
|
||||
html,
|
||||
this.addListeners.bind(this)
|
||||
);
|
||||
}.bind(this)).fail(notification.exception);
|
||||
}.bind(this)).fail(notification.exception);
|
||||
$.when(
|
||||
str.get_string('configurecoursecompetencysettings', 'tool_lp'),
|
||||
templates.render('tool_lp/course_competency_settings', context),
|
||||
)
|
||||
.then(function(title, templateResult) {
|
||||
this._dialogue = new Dialogue(
|
||||
title,
|
||||
templateResult[0],
|
||||
this.addListeners.bind(this)
|
||||
);
|
||||
|
||||
return this._dialogue;
|
||||
}.bind(this))
|
||||
.then(pendingPromise.resolve)
|
||||
.catch(notification.exception);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -108,6 +116,7 @@ define(['jquery',
|
||||
* @method saveSettings
|
||||
*/
|
||||
settingsMod.prototype.saveSettings = function(e) {
|
||||
var pendingPromise = new Pending();
|
||||
e.preventDefault();
|
||||
|
||||
var newValue = this._find('input[name="pushratingstouserplans"]:checked').val();
|
||||
@ -117,9 +126,12 @@ define(['jquery',
|
||||
ajax.call([
|
||||
{methodname: 'core_competency_update_course_competency_settings',
|
||||
args: {courseid: courseId, settings: settings}}
|
||||
])[0].done(function() {
|
||||
this.refreshCourseCompetenciesPage();
|
||||
}.bind(this)).fail(notification.exception);
|
||||
])[0]
|
||||
.then(function() {
|
||||
return this.refreshCourseCompetenciesPage();
|
||||
}.bind(this))
|
||||
.then(pendingPromise.resolve)
|
||||
.catch(notification.exception);
|
||||
|
||||
};
|
||||
|
||||
@ -131,18 +143,23 @@ define(['jquery',
|
||||
*/
|
||||
settingsMod.prototype.refreshCourseCompetenciesPage = function() {
|
||||
var courseId = this._find('input[name="courseid"]').val();
|
||||
var pendingPromise = new Pending();
|
||||
|
||||
ajax.call([
|
||||
{methodname: 'tool_lp_data_for_course_competencies_page',
|
||||
args: {courseid: courseId, moduleid: 0}}
|
||||
])[0].done(function(context) {
|
||||
templates.render('tool_lp/course_competencies_page', context).done(function(html, js) {
|
||||
$('[data-region="coursecompetenciespage"]').replaceWith(html);
|
||||
templates.runTemplateJS(js);
|
||||
this._dialogue.close();
|
||||
}.bind(this)).fail(notification.exception);
|
||||
}.bind(this)).fail(notification.exception);
|
||||
])[0]
|
||||
.then(function(context) {
|
||||
return templates.render('tool_lp/course_competencies_page', context);
|
||||
})
|
||||
.then(function(html, js) {
|
||||
templates.replaceNode($('[data-region="coursecompetenciespage"]'), html, js);
|
||||
this._dialogue.close();
|
||||
|
||||
return;
|
||||
}.bind(this))
|
||||
.then(pendingPromise.resolve)
|
||||
.catch(notification.exception);
|
||||
};
|
||||
|
||||
return /** @alias module:tool_lp/configurecoursecompetencysettings */ settingsMod;
|
||||
|
@ -102,15 +102,20 @@ define(['jquery',
|
||||
* @return {Promise}
|
||||
*/
|
||||
Grade.prototype.display = function() {
|
||||
return this._render().then(function(html) {
|
||||
return Str.get_string('rate', 'tool_lp').then(function(title) {
|
||||
this._popup = new Dialogue(
|
||||
title,
|
||||
html,
|
||||
this._afterRender.bind(this)
|
||||
);
|
||||
}.bind(this));
|
||||
}.bind(this)).fail(Notification.exception);
|
||||
return $.when(
|
||||
Str.get_string('rate', 'tool_lp'),
|
||||
this._render()
|
||||
)
|
||||
.then(function(title, templateResult) {
|
||||
this._popup = new Dialogue(
|
||||
title,
|
||||
templateResult[0],
|
||||
this._afterRender.bind(this)
|
||||
);
|
||||
|
||||
return this._popup;
|
||||
}.bind(this))
|
||||
.catch(Notification.exception);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -95,7 +95,7 @@ define(['jquery',
|
||||
self = this;
|
||||
|
||||
var promise = ScaleValues.get_values(self._scaleId);
|
||||
promise.done(function(scalevalues) {
|
||||
promise.then(function(scalevalues) {
|
||||
options.push({
|
||||
value: '',
|
||||
name: self._chooseStr
|
||||
@ -109,8 +109,13 @@ define(['jquery',
|
||||
});
|
||||
}
|
||||
|
||||
self._dialogue = new GradeDialogue(options);
|
||||
self._dialogue.on('rated', function(e, data) {
|
||||
return options;
|
||||
})
|
||||
.then(function(options) {
|
||||
return new GradeDialogue(options);
|
||||
})
|
||||
.then(function(dialogue) {
|
||||
dialogue.on('rated', function(e, data) {
|
||||
var args = self._args;
|
||||
args.grade = data.rating;
|
||||
args.note = data.note;
|
||||
@ -123,7 +128,15 @@ define(['jquery',
|
||||
fail: notification.exception
|
||||
}]);
|
||||
});
|
||||
}).fail(notification.exception);
|
||||
|
||||
return dialogue;
|
||||
})
|
||||
.then(function(dialogue) {
|
||||
self._dialogue = dialogue;
|
||||
|
||||
return;
|
||||
})
|
||||
.fail(notification.exception);
|
||||
};
|
||||
|
||||
/** @type {Number} The scale id for this competency. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user