Put XBlock css and javascript onto the LMS courseware page

This required changing structural XModules to fully implement
student_view, rather than just returning the HTML of their children in a
get_html call.

[LMS-223]
[LMS-1170]
This commit is contained in:
Calen Pennington
2013-10-04 08:03:25 -04:00
parent 92cc103930
commit 2514dca550
7 changed files with 70 additions and 39 deletions

View File

@@ -7,6 +7,7 @@ from xmodule.seq_module import SequenceDescriptor
from lxml import etree
from xblock.fields import Scope, Integer
from xblock.fragment import Fragment
log = logging.getLogger('mitx.' + __name__)
@@ -77,12 +78,12 @@ class RandomizeModule(RandomizeFields, XModule):
return [self.child_descriptor]
def get_html(self):
def student_view(self, context):
if self.child is None:
# raise error instead? In fact, could complain on descriptor load...
return u"<div>Nothing to randomize between</div>"
return Fragment(content=u"<div>Nothing to randomize between</div>")
return self.child.render('student_view').content
return self.child.render('student_view', context)
def get_icon_class(self):
return self.child.get_icon_class() if self.child else 'other'