Commit 335ee78e by Xavier Antoviaque

Also rewrite jump_to_id URLs in quizz tips & messages

parent ae01d124
......@@ -166,6 +166,17 @@ class XBlockWithLightChildren(LightChildrenMixin, XBlock):
"""
Current HTML view of the XBlock, for refresh by client
"""
frag = self.student_view({})
frag = self.fragment_text_rewriting(frag)
return {
'html': frag.content,
}
def fragment_text_rewriting(self, fragment):
"""
Do replacements like `/jump_to_id` URL rewriting in the provided text
"""
# TODO: Why do we need to use `xmodule_runtime` and not `runtime`?
try:
course_id = self.xmodule_runtime.course_id
......@@ -179,13 +190,8 @@ class XBlockWithLightChildren(LightChildrenMixin, XBlock):
# TODO-WORKBENCH-WORKAROUND: To allow to load from the workbench
jump_to_url = '/jump_to_id'
frag = self.student_view({})
frag = replace_jump_to_id_urls(course_id, jump_to_url, self, 'student_view', frag, {})
return {
'html': frag.content,
}
fragment = replace_jump_to_id_urls(course_id, jump_to_url, self, 'student_view', fragment, {})
return fragment
class LightChild(Plugin, LightChildrenMixin):
"""
......
......@@ -146,7 +146,8 @@ class MentoringBlock(XBlockWithLightChildren):
def get_message_fragment(self, message_type):
for child in self.get_children_objects():
if isinstance(child, MentoringMessageBlock) and child.type == message_type:
return self.render_child(child, 'mentoring_view', {})
frag = self.render_child(child, 'mentoring_view', {})
return self.fragment_text_rewriting(frag)
def get_message_html(self, message_type):
fragment = self.get_message_fragment(message_type)
......
......@@ -167,7 +167,7 @@ class QuizzTipBlock(LightChild):
'self': self,
'named_children': named_children,
}))
return fragment
return self.xblock_container.fragment_text_rewriting(fragment)
def is_completed(self, submission):
return submission and submission not in self.reject_with_defaults
......
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