From cf1b0a86550c3c6fae50e83e8f17e42873d42836 Mon Sep 17 00:00:00 2001 From: Piotr Mitros Date: Mon, 30 Jan 2012 17:44:02 -0500 Subject: [PATCH] Seq module makes nicer class types for Kyle's video styling --- courseware/modules/seq_module.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/courseware/modules/seq_module.py b/courseware/modules/seq_module.py index 02c8320ac8..33c4088486 100644 --- a/courseware/modules/seq_module.py +++ b/courseware/modules/seq_module.py @@ -9,6 +9,10 @@ from mitxmako.shortcuts import render_to_response, render_to_string from x_module import XModule +# HACK: This shouldn't be hard-coded to two types +# OBSOLETE: This obsoletes 'type' +class_priority = ['video', 'problem'] + class SequentialModule(XModule): ''' Layout module which lays out content in a temporal sequence ''' @@ -55,10 +59,21 @@ class SequentialModule(XModule): return {'content':content, "destroy_js":m['destroy_js'], 'init_js':m['init_js'], - 'type':m['type']} + 'type': m['type']} + + + ## Returns a set of all types of all sub-children + child_classes = [set([i.tag for i in e.iter()]) for e in self.xmltree] self.contents=[(e.get("name"),j(self.render_function(e))) \ for e in self.xmltree] + + for (content, element_class) in zip(self.contents, child_classes): + new_class = 'other' + for c in class_priority: + if c in element_class: + new_class = c + content[1]['type'] = new_class js=""