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.
19 lines
817 B
JavaScript
19 lines
817 B
JavaScript
define(["jquery", "js/views/baseview"],
|
|
function ($, BaseView) {
|
|
|
|
return BaseView.extend({
|
|
className: function () {
|
|
return "new-component-templates new-component-" + this.model.type;
|
|
},
|
|
initialize: function () {
|
|
BaseView.prototype.initialize.call(this);
|
|
var template_name = this.model.type === "problem" ? "add-xblock-component-menu-problem" :
|
|
"add-xblock-component-menu";
|
|
this.template = this.loadTemplate(template_name);
|
|
this.$el.html(this.template({type: this.model.type, templates: this.model.templates}));
|
|
// Make the tabs on problems into "real tabs"
|
|
this.$('.tab-group').tabs();
|
|
}
|
|
});
|
|
|
|
}); // end define();
|