This commit implements STUD-1490, allowing creation of components on the container page. It also enables the delete and duplicate buttons now that new content can be created that would benefit. Note that it also creates shared functionality for adding components, and refactors the unit page to use it too.
27 lines
588 B
JavaScript
27 lines
588 B
JavaScript
/**
|
|
* Utilities for modules/xblocks.
|
|
*
|
|
* Returns:
|
|
*
|
|
* urlRoot: the root for creating/updating an xblock.
|
|
* getUpdateUrl: a utility method that returns the xblock update URL, appending
|
|
* the location if passed in.
|
|
*/
|
|
define(["underscore"], function (_) {
|
|
var urlRoot = '/xblock';
|
|
|
|
var getUpdateUrl = function (locator) {
|
|
if (_.isUndefined(locator)) {
|
|
return urlRoot;
|
|
}
|
|
else {
|
|
return urlRoot + "/" + locator;
|
|
}
|
|
};
|
|
return {
|
|
urlRoot: urlRoot,
|
|
getUpdateUrl: getUpdateUrl
|
|
};
|
|
});
|
|
|