This will eventually subclass XBlock and merge HtmlModule and HtmlDescriptor
into one. For now, it's a place to put the pieces that are already sharable
between the two (field information and XBlock handlers).
"""
display_name=String(
display_name=_("Display Name"),
help=_("This name appears in the horizontal navigation at the top of the page."),
...
...
@@ -38,14 +44,20 @@ class HtmlFields(object):
default=_("Text")
)
data=String(help=_("Html contents to display for this module"),default=u"",scope=Scope.content)
source_code=String(help=_("Source code for LaTeX documents. This feature is not well-supported."),scope=Scope.settings)
source_code=String(
help=_("Source code for LaTeX documents. This feature is not well-supported."),
scope=Scope.settings
)
use_latex_compiler=Boolean(
help=_("Enable LaTeX templates?"),
default=False,
scope=Scope.settings
)
editor=String(
help=_("Select Visual to enter content and have the editor automatically create the HTML. Select Raw to edit HTML directly. If you change this setting, you must save the component and then re-open it for editing."),
help=_(
"Select Visual to enter content and have the editor automatically create the HTML. Select Raw to edit "
"HTML directly. If you change this setting, you must save the component and then re-open it for editing."
),
display_name=_("Editor"),
default="visual",
values=[
...
...
@@ -55,8 +67,25 @@ class HtmlFields(object):
scope=Scope.settings
)
@XBlock.supports("multi_device")
defstudent_view(self,_context):
"""
Return a fragment that contains the html for the student view
"""
returnFragment(self.get_html())
classHtmlModuleMixin(HtmlFields,XModule):
defget_html(self):
"""
When we switch this to an XBlock, we can merge this with student_view,
but for now the XModule mixin requires that this method be defined.