Commit ff619d9b by Toby Lawrence

Switch to dedicated student/author views.

parent da664ce7
...@@ -15,6 +15,7 @@ from xmodule.editing_module import MetadataOnlyEditingDescriptor ...@@ -15,6 +15,7 @@ from xmodule.editing_module import MetadataOnlyEditingDescriptor
from xmodule.x_module import XModule from xmodule.x_module import XModule
from xblock.fields import Scope, Dict, Boolean, List, Integer, String from xblock.fields import Scope, Dict, Boolean, List, Integer, String
from xblock.fragment import Fragment
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -233,19 +234,14 @@ class WordCloudModule(WordCloudFields, XModule): ...@@ -233,19 +234,14 @@ class WordCloudModule(WordCloudFields, XModule):
'error': 'Unknown Command!' 'error': 'Unknown Command!'
}) })
def get_html(self): def student_view(self, context):
""" """
Template rendering. Template rendering.
""" """
js_includes = [ fragment = Fragment()
self.runtime.local_resource_url(self, 'public/js/d3.min.js'),
self.runtime.local_resource_url(self, 'public/js/d3.layout.cloud.js'),
self.runtime.local_resource_url(self, 'public/js/word_cloud.js'),
self.runtime.local_resource_url(self, 'public/js/word_cloud_main.js'),
]
context = { fragment.add_content(self.system.render_template('word_cloud.html', {
'ajax_url': self.system.ajax_url, 'ajax_url': self.system.ajax_url,
'display_name': self.display_name, 'display_name': self.display_name,
'instructions': self.instructions, 'instructions': self.instructions,
...@@ -253,10 +249,17 @@ class WordCloudModule(WordCloudFields, XModule): ...@@ -253,10 +249,17 @@ class WordCloudModule(WordCloudFields, XModule):
'element_id': self.location.html_id(), 'element_id': self.location.html_id(),
'num_inputs': self.num_inputs, 'num_inputs': self.num_inputs,
'submitted': self.submitted, 'submitted': self.submitted,
'js_includes': js_includes, }))
}
self.content = self.system.render_template('word_cloud.html', context) fragment.add_javascript_url(self.runtime.local_resource_url(self, 'public/js/d3.min.js'))
return self.content fragment.add_javascript_url(self.runtime.local_resource_url(self, 'public/js/d3.layout.cloud.js'))
fragment.add_javascript_url(self.runtime.local_resource_url(self, 'public/js/word_cloud.js'))
fragment.add_javascript_url(self.runtime.local_resource_url(self, 'public/js/word_cloud_main.js'))
return fragment
def author_view(self, context):
return self.student_view(context)
class WordCloudDescriptor(WordCloudFields, MetadataOnlyEditingDescriptor, EmptyDataRawDescriptor): class WordCloudDescriptor(WordCloudFields, MetadataOnlyEditingDescriptor, EmptyDataRawDescriptor):
......
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
class="${element_class}" class="${element_class}"
data-ajax-url="${ajax_url}" data-ajax-url="${ajax_url}"
> >
% for js_include in js_includes:
<script src="${js_include}"></script>
% endfor
% if display_name: % if display_name:
<h3 class="hd hd-3" id="word_cloud_${element_id}_heading">${display_name}</h3> <h3 class="hd hd-3" id="word_cloud_${element_id}_heading">${display_name}</h3>
% endif % endif
......
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