Commit 69873495 by Calen Pennington

Make icons show up in sequences containing verticals that contain videos

parent c6b477c8
......@@ -61,8 +61,6 @@ class SequenceModule(XModule):
'type': child.get_icon_class(),
})
print json.dumps(contents, indent=4)
# Split </script> tags -- browsers handle this as end
# of script, even if it occurs mid-string. Do this after json.dumps()ing
# so that we can be sure of the quotations being used
......
......@@ -2,6 +2,10 @@ from xmodule.x_module import XModule
from xmodule.seq_module import SequenceDescriptor
from xmodule.progress import Progress
# HACK: This shouldn't be hard-coded to two types
# OBSOLETE: This obsoletes 'type'
class_priority = ['video', 'problem']
class VerticalModule(XModule):
''' Layout module for laying out submodules vertically.'''
......@@ -17,6 +21,14 @@ class VerticalModule(XModule):
progress = reduce(Progress.add_counts, progresses)
return progress
def get_icon_class(self):
child_classes = set(child.get_icon_class() for child in self.get_children())
new_class = 'other'
for c in class_priority:
if c in child_classes:
new_class = c
return new_class
def __init__(self, system, location, definition, instance_state=None, shared_state=None, **kwargs):
XModule.__init__(self, system, location, definition, instance_state, shared_state, **kwargs)
self.contents = [child.get_html() for child in self.get_display_items()]
......
......@@ -11,6 +11,7 @@ log = logging.getLogger(__name__)
class VideoModule(XModule):
video_time = 0
icon_class = 'video'
def handle_ajax(self, dispatch, get):
'''
......
......@@ -63,6 +63,8 @@ class XModule(object):
See the HTML module for a simple example
'''
icon_class = 'other'
def __init__(self, system, location, definition, instance_state=None, shared_state=None, **kwargs):
'''
Construct a new xmodule
......@@ -120,7 +122,7 @@ class XModule(object):
'''
Return a class identifying this module in the context of an icon
'''
return 'other'
return self.icon_class
### Functions used in the LMS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment