Optimize edxnotes files.

This commit is contained in:
cahrens
2015-06-27 07:15:48 -04:00
parent ad16f9f968
commit 497d76fa54
11 changed files with 52 additions and 51 deletions

View File

@@ -60,7 +60,11 @@ source, template_path = _loader.load_template_source(path)
${caller.body()}
});
% else:
require(['${staticfiles_storage.url(module_name + ".js")}'], function () {
## The "raw" parameter is specified to avoid the URL from being further maninpulated by
## static_replace calls (as woudl happen if require_module is used within courseware).
## Without specifying "raw", a call to static_replace would result in the MD5 hash being
## being appended more than once, causing the import to fail in production environments.
require(['${staticfiles_storage.url(module_name + ".js") + "?raw"}'], function () {
require(['${module_name}'], function (${class_name}) {
${caller.body()}
});

File diff suppressed because one or more lines are too long

View File

@@ -3,6 +3,7 @@ import json
from django.utils.translation import ugettext as _
from student.models import anonymous_id_for_user
%>
<%namespace name='static' file='/static_content.html'/>
<%
if user:
params.update({'user': anonymous_id_for_user(user, None)})
@@ -10,11 +11,7 @@ from student.models import anonymous_id_for_user
<div id="edx-notes-wrapper-${uid}" class="edx-notes-wrapper">
<div class="edx-notes-wrapper-content">${content}</div>
</div>
<script type="text/javascript">
(function (require) {
require(['js/edxnotes/views/visibility_decorator'], function(EdxnotesVisibilityDecorator) {
var element = document.getElementById('edx-notes-wrapper-${uid}');
EdxnotesVisibilityDecorator.factory(element, ${json.dumps(params)}, ${edxnotes_visibility});
});
}).call(this, require || RequireJS.require);
</script>
<%static:require_module module_name="js/edxnotes/views/notes_visibility_factory" class_name="NotesVisibilityFactory">
var element = document.getElementById('edx-notes-wrapper-${uid}');
NotesVisibilityFactory.VisibilityDecorator.factory(element, ${json.dumps(params)}, ${edxnotes_visibility});
</%static:require_module>