Implement RequireJS Optimizer in the LMS

TNL-2487
This commit is contained in:
Andy Armstrong
2015-06-23 18:49:38 -04:00
committed by cahrens
parent 80cf4d6ecb
commit 7b5f9b8009
32 changed files with 465 additions and 242 deletions

View File

@@ -2,12 +2,12 @@ define(["jquery", "backbone", "teams/js/teams_tab_factory"],
function($, Backbone, TeamsTabFactory) {
'use strict';
describe("teams django app", function() {
describe("Teams tab", function() {
var teamsTab;
beforeEach(function() {
setFixtures('<section class="teams-content"></section>');
teamsTab = new TeamsTabFactory({results: []}, '', 'edX/DemoX/Demo_Course');
teamsTab = new TeamsTabFactory($(".teams-content"), {results: []}, '', 'edX/DemoX/Demo_Course');
});
afterEach(function() {

View File

@@ -3,11 +3,11 @@
define(['jquery', 'teams/js/views/teams_tab', 'teams/js/collections/topic'],
function ($, TeamsTabView, TopicCollection) {
return function (topics, topics_url, course_id) {
return function (element, topics, topics_url, course_id) {
var topicCollection = new TopicCollection(topics, {url: topics_url, course_id: course_id, parse: true});
topicCollection.bootstrap();
var view = new TeamsTabView({
el: $('.teams-content'),
el: element,
topicCollection: topicCollection
});
view.render();

View File

@@ -21,11 +21,7 @@
</div>
<%block name="js_extra">
<script type="text/javascript">
(function (require) {
require(['teams/js/teams_tab_factory'], function (TeamsTabFactory) {
new TeamsTabFactory(${ json.dumps(topics, cls=EscapedEdxJSONEncoder) }, '${ topics_url }', '${ unicode(course.id) }');
});
}).call(this, require || RequireJS.require);
</script>
<%static:require_module module_name="teams/js/teams_tab_factory" class_name="TeamsTabFactory">
TeamsTabFactory($('.teams-content'), ${ json.dumps(topics, cls=EscapedEdxJSONEncoder) }, '${ topics_url }', '${ unicode(course.id) }');
</%static:require_module>
</%block>