From ec6b1a12e935c752d4fd4c29392113b8cbd6fbf3 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Mon, 19 Nov 2012 15:46:57 -0500 Subject: [PATCH] insert the xmodule.coffee dependency into HTMLSnippet().get_javascript(). This allows us a single point to define this dependency. --- common/lib/xmodule/xmodule/x_module.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 7668c1b1d1..b61bada2c2 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -107,7 +107,20 @@ class HTMLSnippet(object): All of these will be loaded onto the page in the CMS """ - return cls.js + # cdodge: We've moved the xmodule.coffee script from an outside directory into the xmodule area of common + # this means we need to make sure that all xmodules include this dependency which had been previously implicitly + # fulfilled in a different area of code + js = cls.js + + if js is None: + js = {} + + if 'coffee' not in js: + js['coffee'] = [] + + js['coffee'].append(resource_string(__name__, 'js/src/xmodule.coffee')) + + return js @classmethod def get_css(cls):