MDL-54939 amd: fix lint issues

Mostly correcting jsdoc, some other line wrapping rules and empty
functions.
This commit is contained in:
Dan Poltawski 2016-06-16 19:24:34 +01:00
parent 0d06a20038
commit c96f55e6f9
57 changed files with 327 additions and 267 deletions

View File

@ -138,6 +138,7 @@ define(['jquery',
* Find a node in the dialogue.
*
* @param {String} selector
* @return {JQuery} The node
* @method _find
*/
ActionSelector.prototype._find = function(selector) {

View File

@ -35,6 +35,7 @@ define(['jquery',
*
* @param {Number} itemid
* @param {String} itemtype
* @param {Number} pagectxid
*/
var competencies = function(itemid, itemtype, pagectxid) {
this.itemid = itemid;
@ -106,7 +107,7 @@ define(['jquery',
}
]);
} else {
return null;
return;
}
requests[0].fail(notification.exception);

View File

@ -64,7 +64,7 @@ define(['jquery',
* Get the string for an outcome.
*
* @param {Number} id The outcome code.
* @return {Promise Resolved with the string.
* @return {Promise} Resolved with the string.
* @method getString
*/
getString: function(id) {

View File

@ -26,11 +26,11 @@ define(['jquery'], function($) {
/**
* CompetencyPlanNavigation
*
* @param {String} The selector of the competency element.
* @param {String} The base url for the page (no params).
* @param {Number} The user id
* @param {Number} The competency id
* @param {Number} The plan id
* @param {String} competencySelector The selector of the competency element.
* @param {String} baseUrl The base url for the page (no params).
* @param {Number} userId The user id
* @param {Number} competencyId The competency id
* @param {Number} planId The plan id
*/
var CompetencyPlanNavigation = function(competencySelector, baseUrl, userId, competencyId, planId) {
this._baseUrl = baseUrl;

View File

@ -71,6 +71,7 @@ define(['jquery'], function($) {
return null;
};
// eslint-disable-next-line valid-jsdoc
/**
* Return the type of the module.
*
@ -152,7 +153,7 @@ define(['jquery'], function($) {
* Trigger an event.
*
* @param {String} type The type of event.
* @param {Object} The data to pass to the listeners.
* @param {Object} data The data to pass to the listeners.
* @method _trigger
* @protected
*/

View File

@ -187,8 +187,13 @@ define(['jquery',
});
treeRoot.show();
body.on('click', '[data-action="move"]', function() { popup.close(); confirmMove(); });
body.on('click', '[data-action="cancel"]', function() { popup.close(); });
body.on('click', '[data-action="move"]', function() {
popup.close();
confirmMove();
});
body.on('click', '[data-action="cancel"]', function() {
popup.close();
});
};
/**
@ -213,6 +218,7 @@ define(['jquery',
/**
* A node was chosen and "Move" was selected from the menu. Open a popup to select the target.
* @param {Event} e
* @method moveHandler
*/
var moveHandler = function(e) {
@ -300,6 +306,7 @@ define(['jquery',
/**
* Re-render the page with the latest data.
* @param {Object} context
* @method reloadPage
*/
var reloadPage = function(context) {
@ -313,6 +320,7 @@ define(['jquery',
/**
* Perform a search and render the page with the new search results.
* @param {Event} e
* @method updateSearchHandler
*/
var updateSearchHandler = function(e) {
@ -528,6 +536,7 @@ define(['jquery',
/**
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
* @method dragStart
* @param {Event} e
*/
var dragStart = function(e) {
e.originalEvent.dataTransfer.setData('text', $(e.target).parent().data('id'));
@ -536,6 +545,7 @@ define(['jquery',
/**
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
* @method allowDrop
* @param {Event} e
*/
var allowDrop = function(e) {
e.originalEvent.dataTransfer.dropEffect = 'move';
@ -545,6 +555,7 @@ define(['jquery',
/**
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
* @method dragEnter
* @param {Event} e
*/
var dragEnter = function(e) {
e.preventDefault();
@ -554,6 +565,7 @@ define(['jquery',
/**
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
* @method dragLeave
* @param {Event} e
*/
var dragLeave = function(e) {
e.preventDefault();
@ -563,6 +575,7 @@ define(['jquery',
/**
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
* @method dropOver
* @param {Event} e
*/
var dropOver = function(e) {
e.preventDefault();
@ -614,7 +627,7 @@ define(['jquery',
/**
* Log the competency viewed event.
*
* @param {Object} The competency.
* @param {Object} competency The competency.
* @method triggerCompetencyViewedEvent
*/
var triggerCompetencyViewedEvent = function(competency) {
@ -729,6 +742,7 @@ define(['jquery',
* @method selectionChanged
* @param {Event} evt The event that triggered the selection change.
* @param {Object} params The parameters for the event. Contains a list of selected nodes.
* @return {Boolean}
*/
var selectionChanged = function(evt, params) {
var node = params.selected,
@ -781,7 +795,7 @@ define(['jquery',
* Return the string "Selected <taxonomy>".
*
* @function parseTaxonomies
* @param {String} Comma separated list of taxonomies.
* @param {String} taxonomiesstr Comma separated list of taxonomies.
* @return {Array} of level => taxonomystr
*/
var parseTaxonomies = function(taxonomiesstr) {

View File

@ -43,12 +43,13 @@ define(['jquery',
*
*/
var Competencydialogue = function() {
// Intentionally left empty.
};
/**
* Log the competency viewed event.
*
* @param {Number} The competency ID.
* @param {Number} competencyId The competency ID.
* @method triggerCompetencyViewedEvent
*/
Competencydialogue.prototype.triggerCompetencyViewedEvent = function(competencyId) {
@ -112,7 +113,7 @@ define(['jquery',
/**
* The action on the click event.
*
* @param {Event} event click
* @param {Event} e event click
* @method clickEventHandler
*/
Competencydialogue.prototype.clickEventHandler = function(e) {
@ -135,6 +136,7 @@ define(['jquery',
* Get a promise on data competency.
*
* @param {Number} competencyid
* @param {Object} options
* @return {Promise} return promise on data request
* @method getCompetencyDataPromise
*/
@ -160,8 +162,6 @@ define(['jquery',
* Initialise the competency dialogue module.
*
* Only the first call matters.
*
* @return {Void}
*/
init: function() {
if (typeof instance !== 'undefined') {

View File

@ -231,7 +231,10 @@ define(['jquery',
competencyframeworkid: frameworkId
}}
])[0].done(function(competencies) {
/**
* @param {Object} parent
* @param {Array} competencies
*/
function addCompetencyChildren(parent, competencies) {
for (var i = 0; i < competencies.length; i++) {
if (competencies[i].parentid == parent.id) {
@ -265,6 +268,7 @@ define(['jquery',
* Find a node in the dialogue.
*
* @param {String} selector
* @return {JQuery}
* @method _find
*/
Picker.prototype._find = function(selector) {
@ -275,6 +279,7 @@ define(['jquery',
* Convenience method to get a framework object.
*
* @param {Number} fid The framework ID.
* @return {Object}
* @method _getFramework
*/
Picker.prototype._getFramework = function(fid) {
@ -437,7 +442,7 @@ define(['jquery',
*
* This needs to be set after reset/close.
*
* @params {Number[]} The IDs.
* @param {Number[]} ids The IDs.
* @method _setDisallowedCompetencyIDs
*/
Picker.prototype.setDisallowedCompetencyIDs = function(ids) {
@ -448,7 +453,7 @@ define(['jquery',
* Trigger an event.
*
* @param {String} type The type of event.
* @param {Object} The data to pass to the listeners.
* @param {Object} data The data to pass to the listeners.
* @method _reset
*/
Picker.prototype._trigger = function(type, data) {

View File

@ -39,8 +39,8 @@ define(['jquery',
/**
* Competency picker in plan class.
*
* @param {Number} userId
* @param {Number|false} singlePlan The ID of the plan when limited to one.
* @param {String} pageContextIncludes One of 'children', 'parents', 'self'.
* @param {Boolean} multiSelect Support multi-select in the tree.
*/
var Picker = function(userId, singlePlan, multiSelect) {
@ -88,7 +88,7 @@ define(['jquery',
* @param {Number} planId The planId.
* @param {String} searchText Limit the competencies to those matching the text.
* @method _fetchCompetencies
* @return {Promise}
* @return {Promise} The promise object.
*/
Picker.prototype._fetchCompetencies = function(planId, searchText) {
var self = this;

View File

@ -70,7 +70,6 @@ define(['jquery',
*
* Triggered when a change occured.
*
* @return {Void}
* @method _afterChange
* @protected
*/
@ -87,9 +86,10 @@ define(['jquery',
*
* Triggered when a change occured in a specific rule config.
*
* @return {Void}
* @method _afterRuleConfigChange
* @protected
* @param {Event} e
* @param {Rule} rule
*/
RuleConfig.prototype._afterRuleConfigChange = function(e, rule) {
if (rule != this._getRule()) {
@ -102,7 +102,6 @@ define(['jquery',
/**
* After render hook.
*
* @return {Promise}
* @method _afterRender
* @protected
*/
@ -181,6 +180,7 @@ define(['jquery',
* Find a node in the dialogue.
*
* @param {String} selector
* @return {JQuery}
* @method _find
* @protected
*/
@ -444,7 +444,6 @@ define(['jquery',
/**
* Set up the instance.
*
* @return {Void}
* @method _setUp
* @protected
*/
@ -482,7 +481,6 @@ define(['jquery',
/**
* Called when the user switches outcome.
*
* @return {Void}
* @method _switchedOutcome
* @protected
*/
@ -507,7 +505,6 @@ define(['jquery',
/**
* Called when the user switches rule.
*
* @return {Void}
* @method _switchedRule
* @protected
*/
@ -535,7 +532,7 @@ define(['jquery',
* Trigger an event.
*
* @param {String} type The type of event.
* @param {Object} The data to pass to the listeners.
* @param {Object} data The data to pass to the listeners.
* @method _trigger
* @protected
*/

View File

@ -92,6 +92,7 @@ define(['core/yui'], function(Y) {
/**
* Get content.
* @return {node}
*/
dialogue.prototype.getContent = function() {
return this.yuiDialogue.bodyNode.getDOMNode();

View File

@ -48,7 +48,7 @@ define(['jquery'], function($) {
* Trigger an event.
*
* @param {String} type The type of event.
* @param {Object} The data to pass to the listeners.
* @param {Object} data The data to pass to the listeners.
* @method _trigger
*/
Base.prototype._trigger = function(type, data) {

View File

@ -35,7 +35,6 @@ define(['jquery',
*
* @param {String} triggerSelector The node on which the click will happen.
* @param {String} containerSelector The parent node that will be removed and contains the evidence ID.
* @return {Void}
*/
var register = function(triggerSelector, containerSelector) {
if (typeof selectors[triggerSelector] !== 'undefined') {

View File

@ -75,7 +75,6 @@ define(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notificat
* @param {String} selector The selector of the auto complete element.
* @param {String} query The query string.
* @param {Function} callback A callback function receiving an array of results.
* @return {Void}
*/
transport: function(selector, query, callback) {
var el = $(selector),

View File

@ -31,6 +31,7 @@ define(['jquery',
/**
* Grade dialogue class.
* @param {Array} ratingOptions
*/
var Grade = function(ratingOptions) {
EventBase.prototype.constructor.apply(this, []);
@ -46,7 +47,6 @@ define(['jquery',
/**
* After render hook.
*
* @return {Promise}
* @method _afterRender
* @protected
*/
@ -118,6 +118,7 @@ define(['jquery',
*
* @param {String} selector
* @method _find
* @returns {node} The node
* @protected
*/
Grade.prototype._find = function(selector) {

View File

@ -34,12 +34,12 @@ define(['jquery',
* InlineEditor
*
* @param {String} selector The selector to trigger the grading.
* @param {Number} The id of the scale for this competency.
* @param {Number} The id of the competency.
* @param {Number} The id of the user.
* @param {Number} The id of the plan.
* @param {Number} The id of the course.
* @param {String} Language string for choose a rating.
* @param {Number} scaleId The id of the scale for this competency.
* @param {Number} competencyId The id of the competency.
* @param {Number} userId The id of the user.
* @param {Number} planId The id of the plan.
* @param {Number} courseId The id of the course.
* @param {String} chooseStr Language string for choose a rating.
*/
var InlineEditor = function(selector, scaleId, competencyId, userId, planId, courseId, chooseStr) {
EventBase.prototype.constructor.apply(this, []);

View File

@ -44,7 +44,7 @@ define(['jquery'], function($) {
/**
* Constructor
*
* @param {$} Jquery collection matching the root of the menu.
* @param {$} menuRoot Jquery collection matching the root of the menu.
* @param {Function[]} handlers, called when a menu item is chosen.
*/
var Menubar = function(menuRoot, handlers) {
@ -144,7 +144,7 @@ define(['jquery'], function($) {
* @method handleClick
* @param {Object} item is the jquery object of the item firing the event
* @param {Event} e is the associated event object
* @return boolean Returns false
* @return {boolean} Returns false
*/
Menubar.prototype.handleClick = function(item, e) {
e.stopPropagation();

View File

@ -61,7 +61,7 @@ define(['jquery', 'core/ajax', 'core/str', 'tool_lp/competencypicker', 'core/tem
/**
* Set the parent competency in the competency form.
*
* @param {Object} Data containing selected cmpetency.
* @param {Object} data Data containing selected competency.
* @method setParent
*/
ParentCompetencyForm.prototype.setParent = function(data) {
@ -129,7 +129,7 @@ define(['jquery', 'core/ajax', 'core/str', 'tool_lp/competencypicker', 'core/tem
/**
* Main initialisation.
* @param {String} buttonSelector The parent competency button selector.
* @param {String} inputHiddenSelector The hidden input field selector.
* @param {String} inputSelector The hidden input field selector.
* @param {String} staticElementSelector The static element displaying the parent competency.
* @param {Number} frameworkId The competency framework ID.
* @param {Number} pageContextId The page context ID.

View File

@ -198,7 +198,6 @@ define(['jquery', 'core/notification', 'core/templates', 'core/ajax', 'tool_lp/d
*
* @name scaleChangeHandler
* @param {Event} e
* @return {Void}
* @function
*/
ScaleConfig.prototype.scaleChangeHandler = function(e) {

View File

@ -32,7 +32,7 @@ define(['jquery', 'core/ajax'], function($, ajax) {
* @param {Number} scaleid The scale id
* @return [] {Promise}
*/
// eslint-disable-next-line camelcase
get_values: function(scaleid) {
var deferred = $.Deferred();

View File

@ -152,8 +152,7 @@ define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str'
doDelete();
});
}).fail(notification.exception);
}
else {
} else {
str.get_strings([
{ key: 'confirm', component: 'moodle' },
{ key: 'deletetemplate', component: 'tool_lp', param: template.shortname },

View File

@ -230,7 +230,8 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
*/
Tree.prototype.toggleItem = function(item) {
if (!this.multiSelect) {
return this.selectItem(item);
this.selectItem(item);
return;
}
var current = item.attr('aria-selected');
@ -271,6 +272,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
* @method handleKeyDown
* @param {Object} item is the jquery id of the parent item of the group
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleKeyDown = function(item, e) {
var currentIndex = this.visibleItems.index(item);
@ -419,6 +421,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
* @method handleKeyPress
* @param {Object} item is the jquery id of the parent item of the group
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleKeyPress = function(item, e) {
if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
@ -483,6 +486,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
}
}
// eslint-disable-next-line no-unreachable
return true;
};
@ -507,6 +511,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
* @method handleDblClick
* @param {Object} item is the jquery id of the parent item of the group
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleDblClick = function(item, e) {
@ -531,6 +536,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
* @method handleExpandCollapseClick
* @param {Object} item is the jquery id of the parent item of the group
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleExpandCollapseClick = function(item, e) {
@ -547,6 +553,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
* @method handleClick
* @param {Object} item is the jquery id of the parent item of the group
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleClick = function(item, e) {
@ -568,6 +575,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
* @method handleBlur
* @param {Object} item item is the jquery id of the parent item of the group
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleBlur = function() {
return true;
@ -579,6 +587,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
* @method handleFocus
* @param {Object} item item is the jquery id of the parent item of the group
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleFocus = function(item) {

View File

@ -26,12 +26,12 @@ define(['jquery'], function($) {
/**
* UserCompetencyCourseNavigation
*
* @param {String} The selector of the user element.
* @param {String} The selector of the competency element.
* @param {String} The base url for the page (no params).
* @param {Number} The course id
* @param {Number} The user id
* @param {Number} The competency id
* @param {String} userSelector The selector of the user element.
* @param {String} competencySelector The selector of the competency element.
* @param {String} baseUrl The base url for the page (no params).
* @param {Number} userId The user id
* @param {Number} competencyId The competency id
* @param {Number} courseId The course id
*/
var UserCompetencyCourseNavigation = function(userSelector, competencySelector, baseUrl, userId, competencyId, courseId) {
this._baseUrl = baseUrl;

View File

@ -26,12 +26,12 @@ define(['jquery', 'core/notification', 'core/ajax', 'core/templates'], function(
/**
* Info
*
* @param {JQuery} Selector to replace when the information needs updating.
* @param {Number} The id of the competency.
* @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.
* @param {JQuery} rootElement Selector to replace when the information needs updating.
* @param {Number} competencyId The id of the competency.
* @param {Number} userId The id of the user.
* @param {Number} planId The id of the plan.
* @param {Number} courseId The id of the course.
* @param {Boolean} displayuser If we should display the user info.
*/
var Info = function(rootElement, competencyId, userId, planId, courseId, displayuser) {
this._rootElement = rootElement;

View File

@ -27,9 +27,9 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/templates'
/**
* UserCompetencyPopup
*
* @param {String} The regionSelector
* @param {String} The userCompetencySelector
* @param {Number} The plan ID
* @param {String} regionSelector The regionSelector
* @param {String} userCompetencySelector The userCompetencySelector
* @param {Number} planId The plan ID
*/
var UserCompetencyPopup = function(regionSelector, userCompetencySelector, planId) {
this._regionSelector = regionSelector;

View File

@ -47,7 +47,6 @@ define(['jquery',
* Cancel a review request and refresh the view.
*
* @param {Object} data The user competency data.
* @return {Void}
* @method _cancelReviewRequest
*/
UserCompetencyWorkflow.prototype._cancelReviewRequest = function(data) {
@ -71,7 +70,6 @@ define(['jquery',
* Cancel a review request an refresh the view.
*
* @param {Object} data The user competency data.
* @return {Void}
* @method cancelReviewRequest
*/
UserCompetencyWorkflow.prototype.cancelReviewRequest = function(data) {
@ -82,7 +80,6 @@ define(['jquery',
* Cancel a review request handler.
*
* @param {Event} e The event.
* @return {Void}
* @method _cancelReviewRequestHandler
*/
UserCompetencyWorkflow.prototype._cancelReviewRequestHandler = function(e) {
@ -95,7 +92,6 @@ define(['jquery',
* Request a review and refresh the view.
*
* @param {Object} data The user competency data.
* @return {Void}
* @method _requestReview
*/
UserCompetencyWorkflow.prototype._requestReview = function(data) {
@ -119,7 +115,6 @@ define(['jquery',
* Request a review.
*
* @param {Object} data The user competency data.
* @return {Void}
* @method requestReview
*/
UserCompetencyWorkflow.prototype.requestReview = function(data) {
@ -130,7 +125,6 @@ define(['jquery',
* Request a review handler.
*
* @param {Event} e The event.
* @return {Void}
* @method _requestReviewHandler
*/
UserCompetencyWorkflow.prototype._requestReviewHandler = function(e) {
@ -143,7 +137,6 @@ define(['jquery',
* Start a review and refresh the view.
*
* @param {Object} data The user competency data.
* @return {Void}
* @method _startReview
*/
UserCompetencyWorkflow.prototype._startReview = function(data) {
@ -167,7 +160,6 @@ define(['jquery',
* Start a review.
*
* @param {Object} data The user competency data.
* @return {Void}
* @method startReview
*/
UserCompetencyWorkflow.prototype.startReview = function(data) {
@ -178,7 +170,6 @@ define(['jquery',
* Start a review handler.
*
* @param {Event} e The event.
* @return {Void}
* @method _startReviewHandler
*/
UserCompetencyWorkflow.prototype._startReviewHandler = function(e) {
@ -191,7 +182,6 @@ define(['jquery',
* Stop a review and refresh the view.
*
* @param {Object} data The user competency data.
* @return {Void}
* @method _stopReview
*/
UserCompetencyWorkflow.prototype._stopReview = function(data) {
@ -215,7 +205,6 @@ define(['jquery',
* Stop a review.
*
* @param {Object} data The user competency data.
* @return {Void}
* @method stopReview
*/
UserCompetencyWorkflow.prototype.stopReview = function(data) {
@ -226,7 +215,6 @@ define(['jquery',
* Stop a review handler.
*
* @param {Event} e The event.
* @return {Void}
* @method _stopReviewHandler
*/
UserCompetencyWorkflow.prototype._stopReviewHandler = function(e) {

View File

@ -136,7 +136,9 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
// When returns a new promise that is resolved when all the passed in promises are resolved.
// The arguments to the done become the values of each resolved promise.
$.when.apply($, promises)
.done(function(source, originalSource) { templateLoaded(templateName, source, originalSource); })
.done(function(source, originalSource) {
templateLoaded(templateName, source, originalSource);
})
.fail(notification.exception);
};

View File

@ -28,7 +28,7 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
* The ajax call has returned with a new list of templates.
*
* @method reloadListTemplate
* @param String[] templates List of template ids.
* @param {String[]} templateList List of template ids.
*/
var reloadListTemplate = function(templateList) {
templates.render('tool_templatelibrary/search_results', { templates: templateList })
@ -63,8 +63,8 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
* the function will only be executed once.
*
* @method queueRefresh
* @param function callback
* @param int delay The time in milliseconds to delay.
* @param {function} callback
* @param {Number} delay The time in milliseconds to delay.
*/
var queueRefresh = function(callback, delay) {
if (throttle !== null) {

View File

@ -39,7 +39,6 @@ define(['jquery'], function($) {
* @method buildDOM
* @param {Object} rootElement the root element of DOM.
* @param {object} nodes jquery object representing the nodes to be build.
* @return
*/
function buildDOM(rootElement, nodes) {
var ul = $('<ul></ul>');

View File

@ -29,8 +29,8 @@ define(['jquery', 'core/ajax', 'core/config', 'block_navigation/ajax_response_re
* Get the block instance id.
*
* @function getBlockInstanceId
* @param element
* @returns {*}
* @param {Element} element
* @returns {String} the instance id
*/
function getBlockInstanceId(element) {
return element.closest('[data-block]').attr('data-instanceid');

View File

@ -34,18 +34,18 @@ define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function($
* Basically, it performs the binding and handling of the button click event for
* the 'Insert frequently used comment' button.
*
* @param criterionId The criterion ID.
* @param buttonId The element ID of the button which the handler will be bound to.
* @param remarkId The element ID of the remark text area where the text of the selected comment will be copied to.
* @param commentOptions The array of frequently used comments to be used as options.
* @param {Integer} criterionId The criterion ID.
* @param {String} buttonId The element ID of the button which the handler will be bound to.
* @param {String} remarkId The element ID of the remark text area where the text of the selected comment will be copied to.
* @param {Array} commentOptions The array of frequently used comments to be used as options.
*/
initialise: function(criterionId, buttonId, remarkId, commentOptions) {
/**
* Display the chooser dialog using the compiled HTML from the mustache template
* and binds onclick events for the generated comment options.
*
* @param compiledSource The compiled HTML from the mustache template
* @param comments Array containing comments.
* @param {String} compiledSource The compiled HTML from the mustache template
* @param {Array} comments Array containing comments.
*/
function displayChooserDialog(compiledSource, comments) {
var titleLabel = '<label>' + M.util.get_string('insertcomment', 'gradingform_guide') + '</label>';

View File

@ -99,7 +99,7 @@ define(['jquery', 'core/config'], function($, config) {
* Make a series of ajax requests and return all the responses.
*
* @method call
* @param {Object[]} Array of requests with each containing methodname and args properties.
* @param {Object[]} requests Array of requests with each containing methodname and args properties.
* done and fail callbacks can be set for each element in the array, or the
* can be attached to the promises returned by this function.
* @param {Boolean} async Optional, defaults to true.

View File

@ -32,7 +32,7 @@ define(['jquery', 'core/yui'],
* Trigger an event using both JQuery and YUI
*
* @method notifyFilterContentUpdated
* @param {string}|{JQuery} nodes - Selector or list of elements that were inserted.
* @param {string|JQuery} nodes - Selector or list of elements that were inserted.
*/
notifyFilterContentUpdated: function(nodes) {
nodes = $(nodes);

View File

@ -115,7 +115,6 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
* Notify of a change in the selection.
*
* @param {jQuery} originalSelect The jQuery object matching the hidden select list.
* @return {Void}
*/
var notifyChange = function(originalSelect) {
if (typeof M.core_formchangechecker !== 'undefined') {
@ -131,7 +130,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
* @private
* @param {Object} options Original options for this autocomplete element.
* @param {Object} state State variables for this autocomplete element.
* @param {Element} The item to be deselected.
* @param {Element} item The item to be deselected.
* @param {Element} originalSelect The original select list.
*/
var deselectItem = function(options, state, item, originalSelect) {
@ -690,13 +689,14 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
* Turn a boring select box into an auto-complete beast.
*
* @method enhance
* @param {string} select The selector that identifies the select box.
* @param {string} selector The selector that identifies the select box.
* @param {boolean} tags Whether to allow support for tags (can define new entries).
* @param {string} ajax Name of an AMD module to handle ajax requests. If specified, the AMD
* module must expose 2 functions "transport" and "processResults".
* These are modeled on Select2 see: https://select2.github.io/options.html#ajax
* @param {String} placeholder - The text to display before a selection is made.
* @param {Boolean} caseSensitive - If search has to be made case sensitive.
* @param {Boolean} showSuggestions - If suggestions should be shown
* @param {String} noSelectionString - Text to display when there is no selection
*/
enhance: function(selector, tags, ajax, placeholder, caseSensitive, showSuggestions, noSelectionString) {
@ -732,7 +732,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
var originalSelect = $(selector);
if (!originalSelect) {
log.debug('Selector not found: ' + selector);
return false;
return;
}
// Hide the original select.

View File

@ -99,8 +99,8 @@ define(['core/config'], function(config) {
* Hash a string, used to make shorter key prefixes.
*
* @method hashString
* @param string source The string to hash
* @return int The int hash
* @param {String} source The string to hash
* @return {Number}
*/
var hashString = function(source) {
// From http://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript-jquery.

View File

@ -40,7 +40,7 @@ define(['core/loglevel'], function(log) {
/**
* Set default config settings.
*
* @param {String} level The level to use.
* @param {Object} config including the level to use.
* @method setConfig
*/
log.setConfig = function(config) {

View File

@ -54,7 +54,7 @@ define(['jquery', 'core/config', 'core/notification', 'core/templates'], functio
sesskey: config.sesskey
};
$.post(adminurl + 'roles/ajax.php', params, function() {})
$.post(adminurl + 'roles/ajax.php', params)
.done(function(data) {
try {
overideableroles = data;
@ -62,8 +62,7 @@ define(['jquery', 'core/config', 'core/notification', 'core/templates'], functio
$('body').trigger(rolesloadedevent);
};
loadOverideableRoles();
}
catch (err) {
} catch (err) {
notification.exception(err);
}
})
@ -77,7 +76,7 @@ define(['jquery', 'core/config', 'core/notification', 'core/templates'], functio
*
* @access private
* @method changePermissions
* @param {jquery node} row
* @param {JQuery} row
* @param {int} roleid
* @param {string} action
*/
@ -89,7 +88,7 @@ define(['jquery', 'core/config', 'core/notification', 'core/templates'], functio
action: action,
capability: row.data('name')
};
$.post(adminurl + 'roles/ajax.php', params, function() {})
$.post(adminurl + 'roles/ajax.php', params)
.done(function(data) {
var action = data;
try {
@ -133,8 +132,7 @@ define(['jquery', 'core/config', 'core/notification', 'core/templates'], functio
panel.hide();
})
.fail(notification.exception);
}
catch (err) {
} catch (err) {
notification.exception(err);
}
})
@ -244,9 +242,7 @@ define(['jquery', 'core/config', 'core/notification', 'core/templates'], functio
/**
* Initialize permissionmanager
* @access public
* @param {int} contextid
* @param {string} contextname
* @param {string} adminurl
* @param {Object} args
*/
initialize: function(args) {
contextid = args.contextid;
@ -257,4 +253,4 @@ define(['jquery', 'core/config', 'core/notification', 'core/templates'], functio
body.delegate(SELECTORS.REMOVEROLE, 'click', handleRemoveRole);
}
};
});
});

View File

@ -39,6 +39,7 @@ define(['jquery', 'core/ajax', 'core/localstorage'], function($, ajax, storage)
* @param {string} lang The users language - if not passed it is deduced.
* @return {Promise}
*/
// eslint-disable-next-line camelcase
get_string: function(key, component, param, lang) {
var request = this.get_strings([{
key: key,
@ -60,6 +61,7 @@ define(['jquery', 'core/ajax', 'core/localstorage'], function($, ajax, storage)
* See get_string for more info on these args.
* @return {Promise}
*/
// eslint-disable-next-line camelcase
get_strings: function(requests) {
var deferred = $.Deferred();

View File

@ -38,7 +38,11 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
var target = $(this),
query = target.context.search.replace(/^\?/, ''),
tagarea = target.closest('.tagarea[data-ta]'),
args = query.split('&').reduce(function(s, c) { var t = c.split('='); s[t[0]] = decodeURIComponent(t[1]); return s; }, {});
args = query.split('&').reduce(function(s, c) {
var t = c.split('=');
s[t[0]] = decodeURIComponent(t[1]);
return s;
}, {});
var promises = ajax.call([{
methodname: 'core_tag_get_tagindex',
@ -151,8 +155,8 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
tags.each(function() {
var tagid = $(this).val(),
tagname = $('.inplaceeditable[data-itemtype=tagname][data-itemid=' + tagid + ']').attr('data-value');
fldset.append($('<input type="radio" name="maintag" id="combinetags_maintag_' + tagid + '" value="' + tagid +
'"/><label for="combinetags_maintag_' + tagid + '">' + tagname + '</label><br>'));
fldset.append($('<input type="radio" name="maintag" id="combinetags_maintag_' + tagid + '" value="' +
tagid + '"/><label for="combinetags_maintag_' + tagid + '">' + tagname + '</label><br>'));
});
var panel = new M.core.dialogue({
draggable: true,
@ -331,4 +335,4 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
});
}
};
});
});

View File

@ -62,6 +62,7 @@ define(['core/mustache',
* @param {string} templateName - should consist of the component and the name of the template like this:
* core/menu (lib/templates/menu.mustache) or
* tool_bananas/yellow (admin/tool/bananas/templates/yellow.mustache)
* @param {Boolean} async If false - this function will not return until the promises are resolved.
* @return {Promise} JQuery promise object resolved when the template has been fetched.
*/
var getTemplate = function(templateName, async) {
@ -259,10 +260,18 @@ define(['core/mustache',
requiredStrings = [];
requiredJS = [];
context.uniqid = uniqid++;
context.str = function() { return stringHelper; };
context.pix = function() { return pixHelper; };
context.js = function() { return jsHelper; };
context.quote = function() { return quoteHelper; };
context.str = function() {
return stringHelper;
};
context.pix = function() {
return pixHelper;
};
context.js = function() {
return jsHelper;
};
context.quote = function() {
return quoteHelper;
};
context.globals = { config: config };
context.currentTheme = themeName;
};
@ -521,20 +530,24 @@ define(['core/mustache',
* Replace a node in the page with some new HTML and run the JS.
*
* @method replaceNodeContents
* @param {string} source - A block of javascript.
* @param {JQuery} element - Element or selector to replace.
* @param {String} newHTML - HTML to insert / replace.
* @param {String} newJS - Javascript to run after the insertion.
*/
replaceNodeContents: function(element, newHTML, newJS) {
return domReplace(element, newHTML, newJS, true);
domReplace(element, newHTML, newJS, true);
},
/**
* Insert a node in the page with some new HTML and run the JS.
*
* @method replaceNode
* @param {string} source - A block of javascript.
* @param {JQuery} element - Element or selector to replace.
* @param {String} newHTML - HTML to insert / replace.
* @param {String} newJS - Javascript to run after the insertion.
*/
replaceNode: function(element, newHTML, newJS) {
return domReplace(element, newHTML, newJS, false);
domReplace(element, newHTML, newJS, false);
}
};
});

View File

@ -83,6 +83,7 @@ define(['jquery'], function($) {
* Get all visible tree items.
*
* @method getVisibleItems
* @return {Object} visible items
*/
Tree.prototype.getVisibleItems = function() {
return this.treeRoot.data('visibleItems');
@ -340,6 +341,7 @@ define(['jquery'], function($) {
* @method handleKeyDown
* @param {Object} item is the jquery id of the parent item of the group.
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleKeyDown = function(item, e) {
var currentIndex = this.getVisibleItems().index(item);
@ -459,6 +461,7 @@ define(['jquery'], function($) {
* @method handleClick
* @param {Object} item The jquery id of the parent item of the group.
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleClick = function(item, e) {
@ -485,6 +488,7 @@ define(['jquery'], function($) {
* @method handleFocus
* @param {Object} item The jquery id of the parent item of the group.
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleFocus = function(item, e) {
@ -505,9 +509,15 @@ define(['jquery'], function($) {
// Bind event handlers to the tree items. Use event delegates to allow
// for dynamically loaded parts of the tree.
this.treeRoot.on({
click: function(e) { return thisObj.handleClick($(this), e); },
keydown: function(e) { return thisObj.handleKeyDown($(this), e); },
focus: function(e) { return thisObj.handleFocus($(this), e); },
click: function(e) {
return thisObj.handleClick($(this), e);
},
keydown: function(e) {
return thisObj.handleKeyDown($(this), e);
},
focus: function(e) {
return thisObj.handleFocus($(this), e);
},
}, SELECTORS.ITEM);
};

View File

@ -29,10 +29,11 @@ define(['core/config'], function(config) {
return /** @alias module:core/url */ {
// Public variables and functions.
/**
* Generate a style tag referencing this sheet and add it to the head of the page.
* Construct a file url
*
* @method fileUrl
* @param {string} sheet The style sheet name. Must exist in the theme, or one of it's parents.
* @param {string} relativeScript
* @param {string} slashArg
* @return {string}
*/
fileUrl: function(relativeScript, slashArg) {

View File

@ -39,7 +39,9 @@ define(['jquery'], function($) {
this._region.find('[name="savechanges"]').on('click', this._trigger.bind(this, 'save-changes'));
this._region.find('[name="resetbutton"]').on('click', this._trigger.bind(this, 'reset'));
this._region.find('form').on('submit', function(e) { e.preventDefault(); });
this._region.find('form').on('submit', function(e) {
e.preventDefault();
});
};
/** @type {String} Selector for the page region containing the user navigation. */
@ -58,7 +60,6 @@ define(['jquery'], function($) {
* @private
* @param {Event} event
* @param {Integer} userid
* @return {Deferred} promise resolved when the animations are complete.
*/
GradingActions.prototype._showActionsForm = function(event, userid) {
var form = this._region.find('[data-region=grading-actions-form]');

View File

@ -136,7 +136,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
*
* @private
* @method _checkClickOutsideConfigureFilters
* @param {Event}
* @param {Event} event
*/
GradingNavigation.prototype._checkClickOutsideConfigureFilters = function(event) {
var configPanel = this._region.find('[data-region="configure-filters"]');
@ -156,7 +156,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
*
* @private
* @method _filterChanged
* @param {Event}
* @param {Event} event
*/
GradingNavigation.prototype._filterChanged = function(event) {
var name = $(event.target).attr('name');
@ -299,7 +299,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
*
* @private
* @method _toggleExpandFilters
* @param {Event}
* @param {Event} event
*/
GradingNavigation.prototype._toggleExpandFilters = function(event) {
event.preventDefault();
@ -436,7 +436,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
*
* @private
* @method _handleChangeUser
* @param {Event}
* @param {Event} event
*/
GradingNavigation.prototype._handleChangeUser = function() {
var select = this._region.find('[data-action=change-user]');

View File

@ -56,7 +56,7 @@ define(['jquery', 'core/notification', 'core/ajax', 'core/templates'], function(
*
* @private
* @method _getAssignmentId
* @return int assignment id
* @return {Integer} assignment id
*/
UserInfo.prototype._getAssignmentId = function() {
return this._region.attr('data-assignmentid');

View File

@ -100,6 +100,8 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
* Make form submit via ajax.
*
* @private
* @param {Object} event
* @param {Integer} nextUserId
* @method _submitForm
*/
GradingPanel.prototype._submitForm = function(event, nextUserId) {
@ -180,6 +182,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
* Open a picker to choose an older attempt.
*
* @private
* @param {Object} e
* @method _chooseAttempt
*/
GradingPanel.prototype._chooseAttempt = function(e) {
@ -210,7 +213,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
*
* @private
* @method _addPopoutButtons
* @param {JQuery} region The region to add popout buttons to.
* @param {JQuery} selector The region selector to add popout buttons to.
*/
GradingPanel.prototype._addPopoutButtons = function(selector) {
var region = $(selector);
@ -250,7 +253,8 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
* @method _refreshGradingPanel
* @param {Event} event
* @param {Number} userid
* @param {String} serialised submission data.
* @param {String} submissiondata serialised submission data.
* @param {Integer} attemptnumber
*/
GradingPanel.prototype._refreshGradingPanel = function(event, userid, submissiondata, attemptnumber) {
var contextid = this._region.attr('data-contextid');

View File

@ -43,7 +43,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
*
* @method getCartridgeURL
* @private
* @return string
* @return {String}
*/
var getCartridgeURL = function() {
return $(SELECTORS.REGISTRATION_FORM).attr('data-cartridge-url');
@ -54,7 +54,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
*
* @method getSubmitButton
* @private
* @return object jQuery object
* @return {JQuery} jQuery object
*/
var getSubmitButton = function() {
return $(SELECTORS.REGISTRATION_SUBMIT_BUTTON);
@ -65,7 +65,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
*
* @method getCancelButton
* @private
* @return object jQuery object
* @return {JQuery} jQuery object
*/
var getCancelButton = function() {
return $(SELECTORS.REGISTRATION_CANCEL_BUTTON);
@ -76,7 +76,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
*
* @method getConsumerKey
* @private
* @return string
* @return {String} the value entered for consumer key.
*/
var getConsumerKey = function() {
return $(SELECTORS.CONSUMER_KEY).val();
@ -87,7 +87,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
*
* @method getSharedSecret
* @private
* @return string
* @return {String} the value entered for shared secret
*/
var getSharedSecret = function() {
return $(SELECTORS.SHARED_SECRET).val();
@ -118,7 +118,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
*
* @method isLoading
* @private
* @return bool
* @return {Boolean}
*/
var isLoading = function() {
return getSubmitButton().hasClass('loading');
@ -134,7 +134,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
*
* @method submitCartridgeURL
* @private
* @return object jQuery deferred object
* @return {Promise} jQuery Deferred object
*/
var submitCartridgeURL = function() {
if (isLoading()) {
@ -169,7 +169,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
error: true
});
}).fail(notification.exception);
}).always(function() { stopLoading(); });
}).always(function() {
stopLoading();
});
return promise;
};

View File

@ -48,7 +48,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getExternalRegistrationCancelButton
* @private
* @return object jQuery object
* @return {JQuery} jQuery object
*/
var getExternalRegistrationCancelButton = function() {
return $(SELECTORS.EXTERNAL_REGISTRATION_CANCEL_BUTTON);
@ -60,7 +60,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getExternalRegistrationContainer
* @private
* @return object jQuery object
* @return {JQuery} jQuery object
*/
var getExternalRegistrationContainer = function() {
return $(SELECTORS.EXTERNAL_REGISTRATION_CONTAINER);
@ -72,7 +72,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getExternalRegistrationTemplateContainer
* @private
* @return object jQuery object
* @return {JQuery} jQuery object
*/
var getExternalRegistrationTemplateContainer = function() {
return $(SELECTORS.EXTERNAL_REGISTRATION_TEMPLATE_CONTAINER);
@ -85,7 +85,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getToolTypeCapabilitiesContainer
* @private
* @return object jQuery object
* @return {JQuery} jQuery object
*/
var getToolTypeCapabilitiesContainer = function() {
return $(SELECTORS.TOOL_TYPE_CAPABILITIES_CONTAINER);
@ -97,7 +97,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getToolTypeCapabilitiesTemplateContainer
* @private
* @return object jQuery object
* @return {JQuery} jQuery object
*/
var getToolTypeCapabilitiesTemplateContainer = function() {
return $(SELECTORS.TOOL_TYPE_CAPABILITIES_TEMPLATE_CONTAINER);
@ -188,7 +188,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method setToolProxyId
* @private
* @param int Tool proxy ID
* @param {Integer} id Tool proxy ID
*/
var setToolProxyId = function(id) {
var button = getExternalRegistrationCancelButton();
@ -200,7 +200,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getToolProxyId
* @private
* @return string Tool proxy ID
* @return {String} Tool proxy ID
*/
var getToolProxyId = function() {
var button = getExternalRegistrationCancelButton();
@ -223,7 +223,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method hasToolProxyId
* @private
* @return bool
* @return {Boolean}
*/
var hasToolProxyId = function() {
return getToolProxyId() ? true : false;
@ -235,7 +235,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method hasCreatedToolProxy
* @private
* @return bool
* @return {Boolean}
*/
var hasCreatedToolProxy = function() {
var button = getExternalRegistrationCancelButton();
@ -247,7 +247,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method setProxyAsNew
* @private
* @return bool
* @return {Boolean}
*/
var setProxyAsNew = function() {
var button = getExternalRegistrationCancelButton();
@ -259,7 +259,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method setProxyAsOld
* @private
* @return bool
* @return {Boolean}
*/
var setProxyAsOld = function() {
var button = getExternalRegistrationCancelButton();
@ -274,8 +274,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getRegistrationRequest
* @private
* @param int Tool Proxy ID
* @return object jQuery Deferred object
* @param {Integer} id Tool Proxy ID
* @return {Promise} jQuery Deferred object
*/
var getRegistrationRequest = function(id) {
var request = {
@ -294,7 +294,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method cancelRegistration
* @private
* @return object jQuery Deferred object
* @return {Promise} jQuery Deferred object
*/
var cancelRegistration = function() {
startLoadingCancel();
@ -338,7 +338,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method renderExternalRegistrationWindow
* @private
* @return object jQuery Deferred object
* @param {Object} registrationRequest
* @return {Promise} jQuery Deferred object
*/
var renderExternalRegistrationWindow = function(registrationRequest) {
var promise = templates.render('mod_lti/tool_proxy_registration_form', registrationRequest);
@ -361,9 +362,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method setTypeStatusActive
* @private
* @param object A set of data representing a type, as returned by a request to get a type
* @param {Object} typeData A set of data representing a type, as returned by a request to get a type
* from the Moodle server.
* @return object jQuery Deferred object
* @return {Promise} jQuery Deferred object
*/
var setTypeStatusActive = function(typeData) {
return toolType.update({
@ -380,9 +381,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method promptForToolTypeCapabilitiesAgreement
* @private
* @param object A set of data representing a type, as returned by a request to get a type
* @param {Object} typeData A set of data representing a type, as returned by a request to get a type
* from the Moodle server.
* @return object jQuery Deferred object
* @return {Promise} jQuery Deferred object
*/
var promptForToolTypeCapabilitiesAgreement = function(typeData) {
var promise = $.Deferred();
@ -436,8 +437,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method createAndRegisterToolProxy
* @private
* @param url Tool registration URL to register
* @return object jQuery Deferred object
* @param {String} url Tool registration URL to register
* @return {Promise} jQuery Deferred object
*/
var createAndRegisterToolProxy = function(url) {
var promise = $.Deferred();
@ -476,8 +477,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method registerProxy
* @private
* @param id Proxy id to register
* @return jQuery Deferred object to fail or resolve
* @param {Integer} id Proxy id to register
* @return {Promise} jQuery Deferred object to fail or resolve
*/
var registerProxy = function(id) {
var promise = $.Deferred();

View File

@ -35,11 +35,11 @@ define([], function() {
* complete behaviour in the parent page and provide the params returned from
* the external registration page.
*
* @param string message The registration message from the external registration page
* @param string error The registration error message from the external registration page, if
* @param {String} message The registration message from the external registration page
* @param {String} error The registration error message from the external registration page, if
* there was an error.
* @param int id The tool proxy id for the external registration.
* @param string status Whether the external registration was successful or not.
* @param {Integer} id The tool proxy id for the external registration.
* @param {String} status Whether the external registration was successful or not.
*/
init: function(message, error, id, status) {
if (window.parent) {

View File

@ -46,8 +46,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method getDeleteButton
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery object
* @param {JQuery} element jQuery object representing the tool card.
* @return {JQuery} jQuery object
*/
var getDeleteButton = function(element) {
return element.find(SELECTORS.DELETE_BUTTON);
@ -58,8 +58,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method getNameElement
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery object
* @param {JQuery} element jQuery object representing the tool card.
* @return {JQuery} jQuery object
*/
var getNameElement = function(element) {
return element.find(SELECTORS.NAME_ELEMENT);
@ -70,8 +70,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method getDescriptionElement
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery object
* @param {JQuery} element jQuery object representing the tool card.
* @return {JQuery} jQuery object
*/
var getDescriptionElement = function(element) {
return element.find(SELECTORS.DESCRIPTION_ELEMENT);
@ -82,8 +82,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method getActivateButton
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery object
* @param {Object} element jQuery object representing the tool card.
* @return {Object} jQuery object
*/
var getActivateButton = function(element) {
return element.find(SELECTORS.ACTIVATE_BUTTON);
@ -94,8 +94,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method hasActivateButton
* @private
* @param object jQuery object representing the tool card.
* @return bool
* @param {JQuery} element jQuery object representing the tool card.
* @return {Boolean} true if has active buton
*/
var hasActivateButton = function(element) {
return getActivateButton(element).length ? true : false;
@ -107,8 +107,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method getCapabilitiesContainer
* @private
* @param object jQuery object representing the tool card.
* @return bool
* @param {Object} element jQuery object representing the tool card.
* @return {Object} The element
*/
var getCapabilitiesContainer = function(element) {
return element.find(SELECTORS.CAPABILITIES_CONTAINER);
@ -120,8 +120,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method hasCapabilitiesContainer
* @private
* @param object jQuery object representing the tool card.
* @return bool
* @param {JQuery} element jQuery object representing the tool card.
* @return {Boolean} true if has capbilities.
*/
var hasCapabilitiesContainer = function(element) {
return getCapabilitiesContainer(element).length ? true : false;
@ -132,8 +132,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method getTypeId
* @private
* @param object jQuery object representing the tool card.
* @return string Type ID
* @param {Object} element jQuery object representing the tool card.
* @return {String} Type ID
*/
var getTypeId = function(element) {
return element.attr('data-type-id');
@ -144,7 +144,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method clearAllAnnouncements
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var clearAllAnnouncements = function(element) {
element.removeClass('announcement loading success fail capabilities');
@ -155,7 +155,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method startLoading
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var startLoading = function(element) {
clearAllAnnouncements(element);
@ -167,7 +167,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method stopLoading
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var stopLoading = function(element) {
element.removeClass('announcement loading');
@ -179,8 +179,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method announceSuccess
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery Deferred object
* @param {JQuery} element jQuery object representing the tool card.
* @return {Promise} jQuery Deferred object
*/
var announceSuccess = function(element) {
var promise = $.Deferred();
@ -201,8 +201,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method announceFailure
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery Deferred object
* @param {JQuery} element jQuery object representing the tool card.
* @return {Promise} jQuery Deferred object
*/
var announceFailure = function(element) {
var promise = $.Deferred();
@ -223,8 +223,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method deleteType
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery Deferred object
* @param {JQuery} element jQuery object representing the tool card.
* @return {Promise} jQuery Deferred object
*/
var deleteType = function(element) {
var promise = $.Deferred();
@ -291,8 +291,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method setValueSnapshot
* @private
* @param object jQuery object representing the element.
* @param string value to be saved.
* @param {JQuery} element jQuery object representing the element.
* @param {String} value to be saved.
*/
var setValueSnapshot = function(element, value) {
element.attr('data-val-snapshot', value);
@ -303,8 +303,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method getValueSnapshot
* @private
* @param object jQuery object representing the element.
* @return string the saved value.
* @param {JQuery} element jQuery object representing the element.
* @return {String} the saved value.
*/
var getValueSnapshot = function(element) {
return element.attr('data-val-snapshot');
@ -315,7 +315,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method snapshotDescription
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var snapshotDescription = function(element) {
var descriptionElement = getDescriptionElement(element);
@ -334,8 +334,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method updateDescription
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery Deferred object
* @param {JQuery} element jQuery object representing the tool card.
* @return {Promise} jQuery Deferred object
*/
var updateDescription = function(element) {
var typeId = getTypeId(element);
@ -375,7 +375,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
// Probably need to handle failures better so that we can revert
// the value in the input for the user.
promise.fail(function() { descriptionElement.removeClass('loading'); });
promise.fail(function() {
descriptionElement.removeClass('loading');
});
return promise;
};
@ -385,7 +387,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method snapshotName
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var snapshotName = function(element) {
var nameElement = getNameElement(element);
@ -404,8 +406,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method updateName
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery Deferred object
* @param {JQuery} element jQuery object representing the tool card.
* @return {Promise} jQuery Deferred object
*/
var updateName = function(element) {
var typeId = getTypeId(element);
@ -443,7 +445,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
// Probably need to handle failures better so that we can revert
// the value in the input for the user.
promise.fail(function() { nameElement.removeClass('loading'); });
promise.fail(function() {
nameElement.removeClass('loading');
});
return promise;
};
@ -455,8 +459,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method setStatusActive
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery Deferred object
* @param {JQuery} element jQuery object representing the tool card.
* @return {Promise} jQuery Deferred object
*/
var setStatusActive = function(element) {
var id = getTypeId(element);
@ -501,7 +505,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method displayCapabilitiesApproval
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var displayCapabilitiesApproval = function(element) {
element.addClass('announcement capabilities');
@ -512,7 +516,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method hideCapabilitiesApproval
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var hideCapabilitiesApproval = function(element) {
element.removeClass('announcement capabilities');
@ -525,7 +529,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method activateToolType
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var activateToolType = function(element) {
if (hasCapabilitiesContainer(element)) {
@ -540,7 +544,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method registerEventListeners
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var registerEventListeners = function(element) {
var deleteButton = getDeleteButton(element);
@ -634,7 +638,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
/**
* Initialise this module.
*
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
init: function(element) {
registerEventListeners(element);

View File

@ -46,7 +46,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getToolCreateButton
* @private
* @return object jQuery object
* @return {Object} jQuery object
*/
var getToolCreateButton = function() {
return $(SELECTORS.TOOL_CREATE_BUTTON);
@ -57,7 +57,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getToolListContainer
* @private
* @return object jQuery object
* @return {Object} jQuery object
*/
var getToolListContainer = function() {
return $(SELECTORS.TOOL_LIST_CONTAINER);
@ -68,7 +68,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getExternalRegistrationContainer
* @private
* @return object jQuery object
* @return {Object} jQuery object
*/
var getExternalRegistrationContainer = function() {
return $(SELECTORS.EXTERNAL_REGISTRATION_CONTAINER);
@ -79,7 +79,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getCartridgeRegistrationContainer
* @private
* @return object jQuery object
* @return {Object} jQuery object
*/
var getCartridgeRegistrationContainer = function() {
return $(SELECTORS.CARTRIDGE_REGISTRATION_CONTAINER);
@ -90,7 +90,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getRegistrationChoiceContainer
* @private
* @return object jQuery object
* @return {Object} jQuery object
*/
var getRegistrationChoiceContainer = function() {
return $(SELECTORS.REGISTRATION_CHOICE_CONTAINER);
@ -101,7 +101,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method getToolURL
* @private
* @return string
* @return {String} the tool type url
*/
var getToolURL = function() {
return $(SELECTORS.TOOL_URL).val();
@ -156,6 +156,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
* panels.
*
* @method showCartridgeRegistration
* @param {String} url
* @private
*/
var showCartridgeRegistration = function(url) {
@ -172,6 +173,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
* This function can be removed once JAWS supports visibility.
*
* @method screenReaderAnnounce
* @param {Object} element
* @private
*/
var screenReaderAnnounce = function(element) {
@ -218,6 +220,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
* Display the registration feedback alert and hide the other panels.
*
* @method showRegistrationFeedback
* @param {Object} data
* @private
*/
var showRegistrationFeedback = function(data) {
@ -233,7 +236,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method startLoading
* @private
* @param object jQuery object
* @param {Object} element jQuery object
*/
var startLoading = function(element) {
element.addClass("loading");
@ -244,7 +247,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method stopLoading
* @private
* @param object jQuery object
* @param {Object} element jQuery object
*/
var stopLoading = function(element) {
element.removeClass("loading");
@ -288,7 +291,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
*
* @method addTool
* @private
* @return object jQuery deferred object
* @return {Promise} jQuery Deferred object
*/
var addTool = function() {
var url = $.trim(getToolURL());
@ -302,7 +305,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
var promise = toolType.isCartridge(url);
promise.always(function() { stopLoading(toolButton); });
promise.always(function() {
stopLoading(toolButton);
});
promise.done(function(result) {
if (result.iscartridge) {

View File

@ -34,8 +34,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
*
* @method query
* @public
* @param object Search parameters
* @return object jQuery deferred object
* @param {Object} args Search parameters
* @return {Promise} jQuery Deferred object
*/
query: function(args) {
var request = {
@ -54,8 +54,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
*
* @method delete
* @public
* @param int Tool proxy ID
* @return object jQuery deferred object
* @param {Integer} id Tool proxy ID
* @return {Promise} jQuery Deferred object
*/
delete: function(id) {
var request = {
@ -81,8 +81,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
*
* @method create
* @public
* @param object Tool proxy properties
* @return object jQuery deferred object
* @param {Object} args Tool proxy properties
* @return {Promise} jQuery Deferred object
*/
create: function(args) {
var request = {

View File

@ -44,8 +44,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method getDeleteButton
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery object
* @param {JQuery} element jQuery object representing the tool card.
* @return {JQuery} jQuery object
*/
var getDeleteButton = function(element) {
return element.find(SELECTORS.DELETE_BUTTON);
@ -56,8 +56,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method getActivateButton
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery object
* @param {JQuery} element jQuery object representing the tool card.
* @return {JQuery} jQuery object
*/
var getActivateButton = function(element) {
return element.find(SELECTORS.ACTIVATE_BUTTON);
@ -68,8 +68,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method getTypeId
* @private
* @param object jQuery object representing the tool card.
* @return string Type ID
* @param {JQuery} element jQuery object representing the tool card.
* @return {String} Type ID
*/
var getTypeId = function(element) {
return element.attr('data-proxy-id');
@ -80,7 +80,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method clearAllAnnouncements
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var clearAllAnnouncements = function(element) {
element.removeClass('announcement loading success fail capabilities');
@ -91,7 +91,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method startLoading
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var startLoading = function(element) {
clearAllAnnouncements(element);
@ -103,7 +103,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method stopLoading
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var stopLoading = function(element) {
element.removeClass('announcement loading');
@ -115,8 +115,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method announceSuccess
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery Deferred object
* @param {JQuery} element jQuery object representing the tool card.
* @return {Promise} jQuery Deferred object
*/
var announceSuccess = function(element) {
var promise = $.Deferred();
@ -137,8 +137,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method announceFailure
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery Deferred object
* @param {JQuery} element jQuery object representing the tool card.
* @return {Promise} jQuery Deferred object
*/
var announceFailure = function(element) {
var promise = $.Deferred();
@ -159,8 +159,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method deleteType
* @private
* @param object jQuery object representing the tool card.
* @return object jQuery Deferred object
* @param {JQuery} element jQuery object representing the tool card.
* @return {Promise} jQuery Deferred object
*/
var deleteType = function(element) {
var promise = $.Deferred();
@ -226,7 +226,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method activateToolType
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var activateToolType = function(element) {
var data = {proxyid: getTypeId(element)};
@ -238,7 +238,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
*
* @method registerEventListeners
* @private
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
var registerEventListeners = function(element) {
var deleteButton = getDeleteButton(element);
@ -275,7 +275,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
/**
* Initialise this module.
*
* @param object jQuery object representing the tool card.
* @param {JQuery} element jQuery object representing the tool card.
*/
init: function(element) {
registerEventListeners(element);

View File

@ -34,8 +34,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
*
* @method query
* @public
* @param object Search parameters
* @return object jQuery deferred object
* @param {Object} args Search parameters
* @return {Promise} jQuery Deferred object
*/
query: function(args) {
var request = {
@ -60,8 +60,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
*
* @method create
* @public
* @param object Tool type properties
* @return object jQuery deferred object
* @param {Object} args Tool type properties
* @return {Promise} jQuery Deferred object
*/
create: function(args) {
var request = {
@ -82,8 +82,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
*
* @method update
* @public
* @param object Tool type properties
* @return object jQuery deferred object
* @param {Object} args Tool type properties
* @return {Promise} jQuery Deferred object
*/
update: function(args) {
var request = {
@ -103,8 +103,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
*
* @method delete
* @public
* @param int Tool type ID
* @return object jQuery deferred object
* @param {Integer} id Tool type ID
* @return {Promise} jQuery Deferred object
*/
delete: function(id) {
var request = {
@ -127,8 +127,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
*
* @method query
* @public
* @param int Tool proxty id
* @return object jQuery deferred object
* @param {Integer} id Tool type ID
* @return {Promise} jQuery Deferred object
*/
getFromToolProxyId: function(id) {
return this.query({toolproxyid: id});
@ -141,8 +141,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
*
* @method isCartridge
* @public
* @param string URL
* @return object jQuery deferred object
* @param {String} url
* @return {Promise} jQuery Deferred object
*/
isCartridge: function(url) {
var request = {

View File

@ -37,7 +37,7 @@ define(['jquery', 'core/yui'], function($, Y) {
/**
* Initialise the start attempt button.
*
* @param {String} startButtonId the id of the start attempt button that we will be enhancing.
* @param {String} startButton the id of the start attempt button that we will be enhancing.
* @param {String} confirmationTitle the title of the dialogue.
* @param {String} confirmationForm selector for the confirmation form to show in the dialogue.
* @param {String} popupoptions If not null, the quiz should be launced in a pop-up.
@ -94,6 +94,8 @@ define(['jquery', 'core/yui'], function($, Y) {
/**
* Event handler for the quiz start attempt button.
* @param {Event} e the event being responded to
* @param {Object} popupoptions
*/
launchQuizPopup: function(e, popupoptions) {
e.halt();

View File

@ -27,8 +27,8 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'cor
/**
* GradingPopup
*
* @param {String} The regionSelector
* @param {String} The userCompetencySelector
* @param {String} regionSelector The regionSelector
* @param {String} userCompetencySelector The userCompetencySelector
*/
var GradingPopup = function(regionSelector, userCompetencySelector) {
this._regionSelector = regionSelector;
@ -41,7 +41,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'cor
* Get the data from the clicked cell and open the popup.
*
* @method _handleClick
* @param {Event} e
* @param {Event} e The event
*/
GradingPopup.prototype._handleClick = function(e) {
var cell = $(e.target).closest(this._userCompetencySelector);

View File

@ -26,10 +26,10 @@ define(['jquery'], function($) {
/**
* UserCourseNavigation
*
* @param {String} The selector of the user element.
* @param {String} The base url for the page (no params).
* @param {Number} The course id
* @param {Number} The user id
* @param {String} userSelector The selector of the user element.
* @param {String} baseUrl The base url for the page (no params).
* @param {Number} userId The course id
* @param {Number} courseId The user id
*/
var UserCourseNavigation = function(userSelector, baseUrl, userId, courseId) {
this._baseUrl = baseUrl;
@ -43,7 +43,7 @@ define(['jquery'], function($) {
* The user was changed in the select list.
*
* @method _userChanged
* @param {Event} e
* @param {Event} e the event
*/
UserCourseNavigation.prototype._userChanged = function(e) {
var newUserId = $(e.target).val();