library.js 910 Bytes
Newer Older
1
define([
2 3
    'jquery', 'underscore', 'js/models/xblock_info', 'js/views/pages/paged_container',
    'js/views/library_container', 'js/collections/component_template', 'xmodule', 'coffee/src/main',
4 5
    'xblock/cms.runtime.v1'
],
6
function($, _, XBlockInfo, PagedContainerPage, LibraryContainerView, ComponentTemplates, xmoduleLoader) {
7
    'use strict';
8 9 10 11 12
    return function (componentTemplates, XBlockInfoJson, options) {
        var main_options = {
            el: $('#content'),
            model: new XBlockInfo(XBlockInfoJson, {parse: true}),
            templates: new ComponentTemplates(componentTemplates, {parse: true}),
13
            action: 'view',
14 15
            viewClass: LibraryContainerView,
            canEdit: true
16
        };
17 18

        xmoduleLoader.done(function () {
19
            var view = new PagedContainerPage(_.extend(main_options, options));
20 21 22 23
            view.render();
        });
    };
});