diff --git a/common/lib/xmodule/xmodule/gst_module.py b/common/lib/xmodule/xmodule/gst_module.py
index 7e61264929..34ecd66872 100644
--- a/common/lib/xmodule/xmodule/gst_module.py
+++ b/common/lib/xmodule/xmodule/gst_module.py
@@ -25,6 +25,8 @@ class GraphicalSliderToolModule(XModule):
js = {
'js': [
+ # 3rd party libraries used by graphic slider tool.
+ # TODO - where to store them - outside xmodule?
resource_string(__name__, 'js/src/graphical_slider_tool/jstat-1.0.0.min.js'),
resource_string(__name__, 'js/src/graphical_slider_tool/gst_main.js'),
@@ -44,32 +46,40 @@ class GraphicalSliderToolModule(XModule):
def __init__(self, system, location, definition, descriptor, instance_state=None,
shared_state=None, **kwargs):
"""
- For XML file format please look at documentation.
-
+ For XML file format please look at documentation. TODO - receive
+ information where to store XML documentation.
"""
XModule.__init__(self, system, location, definition, descriptor,
instance_state, shared_state, **kwargs)
def get_html(self):
- self.get_configuration()
+ """ Renders parameters to template. """
+
+ # these both will be used in class methods
self.html_id = self.location.html_id()
self.html_class = self.location.category
- gst_html = self.substitute_controls(self.definition['render'].strip())
- # import ipdb; ipdb.set_trace()
params = {
- 'gst_html': gst_html,
+ 'gst_html': self.substitute_controls(self.definition['render']),
'element_id': self.html_id,
'element_class': self.html_class,
- 'configuration_json': self.configuration_json
+ 'configuration_json': self.build_configuration_json()
}
self.content = (self.system.render_template(
'graphical_slider_tool.html', params))
- # import ipdb; ipdb.set_trace()
return self.content
def substitute_controls(self, html_string):
- """ Substitue control element via their divs.
- Simple variant: slider and plot controls are not inside any tag.
+ """ Substitutes control elements via their divs.
+ TODO: change regexps to html parsing via beautiful soup or something
+ similar (aim : simpler support).
+
+ Args:
+ html_string: rendered html string with controls as xml tags
+ (