*
* To handle 'save' events use: actionselector.on('save')
* This will receive the information to display in popup.
- * The actions have the format [{'text': sometext, 'value' : somevalue}]
+ * The actions have the format [{'text': sometext, 'value' : somevalue}].
*
* @package tool_lp
* @copyright 2016 Serge Gauthier - <serge.gauthier.2@umontreal.ca>
*/
var ActionSelector = function(title, message, actions, confirm, cancel) {
var self = this;
-
+
EventBase.prototype.constructor.apply(this, []);
self._title = title;
self._message = message;
};
ActionSelector.prototype = Object.create(EventBase.prototype);
-
+
/** @type {String} The value that was selected. */
ActionSelector.prototype._selectedValue = null;
/** @type {Dialogue} The reference to the dialogue. */
for (var i in self._actions) {
choices.push(self._actions[i]);
}
- var content = {'message': self._message, 'choices' : choices,
+ var content = {'message': self._message, 'choices' : choices,
'confirm' : self._confirm, 'cancel' : self._cancel};
-
+
return Templates.render('tool_lp/action_selector', content);
};
*
* @method _reset
*/
- ActionSelector.prototype._reset = function() {
+ ActionSelector.prototype._reset = function() {
this._popup = null;
this._selectedValue = '';
};
/**
* Show a confirm dialogue before deleting a competency.
- *
+ *
* @method deleteHandler
* @param {int} deleteid The id of record to delete.
*/
settingsMod.prototype._find = function(selector) {
return $('[data-region="coursecompetencysettings"]').find(selector);
};
-
+
/**
* Save the settings.
*
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str','tool_lp/actionselector'],
+define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str','tool_lp/actionselector'],
function($, templates, ajax, notification, str, Actionselector) {
// Private variables and functions.
/** @var {Number} templateid The id of the template */
var templateid = 0;
-
+
/** @var {Boolean} Action to apply to plans when deleting a template */
var deleteplans = true;
{ key: 'confirm', component: 'moodle' },
{ key: 'cancel', component: 'moodle' }
]).done(function (strings) {
- var actions = [{'text': strings[2], 'value' : 'delete'},
+ var actions = [{'text': strings[2], 'value' : 'delete'},
{'text': strings[3], 'value' : 'unlink'}];
var actionselector = new Actionselector(
strings[0], // Title.
strings[1], // Message
actions, // Radio button options.
strings[4], // Confirm.
- strings[5]); // Cancel.
+ strings[5]); // Cancel.
actionselector.display();
actionselector.on('save', function(e, data) {
if (data.action != 'delete') {
doDelete
);
}).fail(notification.exception);
- }
+ }
}).fail(notification.exception);
}).fail(notification.exception);
Scenario: Edit a framework with competencies in user competency
Given the following lp "frameworks" exist:
- | shortname | idnumber |
+ | shortname | idnumber |
| Science Year-5 | sc-y-5 |
And the following lp "competencies" exist:
| shortname | framework |
| Plan Science-5 | Comp1 |
| Plan Science-5 | Comp2 |
And the following lp "usercompetencies" exist:
- | user | competency |
+ | user | competency |
| admin | Comp1 |
| admin | Comp2 |
And I follow "Competency Frameworks"
Scenario: Edit a framework with competencies in user competency plan
Given the following lp "frameworks" exist:
- | shortname | idnumber |
+ | shortname | idnumber |
| Science Year-6 | sc-y-6 |
And the following lp "competencies" exist:
| shortname | framework |
done: this._contextLoaded.bind(this),
fail: notification.exception
}]);
-
+
// Log the user competency viewed in course event.
requests[0].then(function(){
ajax.call([{