Implement children for pure XBlocks in edx-platform

This requires fixing the javascript api implementation, and adding
an implementation of get_block to the ModuleSystem api.

However, the implementation is incomplete, due to mismatches between
the expectations of XModule and XBlock.

Also adds tests using the Acid block to make sure that the javascript
and python apis for children are working correctly.
This commit is contained in:
Calen Pennington
2014-02-13 09:53:32 -05:00
parent 3093efc889
commit dbc99ef8ad
21 changed files with 228 additions and 77 deletions

View File

@@ -131,6 +131,7 @@ def _preview_module_system(request, descriptor):
# get_user_role accepts a location or a CourseLocator.
# If descriptor.location is a CourseLocator, course_id is unused.
get_user_role=lambda: get_user_role(request.user, descriptor.location, course_id),
descriptor_runtime=descriptor.runtime,
)
@@ -158,6 +159,6 @@ def get_preview_fragment(request, descriptor):
try:
fragment = module.render("student_view")
except Exception as exc: # pylint: disable=W0703
log.debug("Unable to render student_view for %r", module, exc_info=True)
log.warning("Unable to render student_view for %r", module, exc_info=True)
fragment = Fragment(render_to_string('html_error.html', {'message': str(exc)}))
return fragment

View File

@@ -3,7 +3,7 @@ define ["jquery", "xblock/runtime.v1", "URI"], ($, XBlock, URI) ->
class PreviewRuntime.v1 extends XBlock.Runtime.v1
handlerUrl: (element, handlerName, suffix, query, thirdparty) ->
uri = URI("/preview/xblock").segment($(@element).data('usage-id'))
uri = URI("/preview/xblock").segment($(element).data('usage-id'))
.segment('handler')
.segment(handlerName)
if suffix? then uri.segment(suffix)
@@ -14,7 +14,7 @@ define ["jquery", "xblock/runtime.v1", "URI"], ($, XBlock, URI) ->
class StudioRuntime.v1 extends XBlock.Runtime.v1
handlerUrl: (element, handlerName, suffix, query, thirdparty) ->
uri = URI("/xblock").segment($(@element).data('usage-id'))
uri = URI("/xblock").segment($(element).data('usage-id'))
.segment('handler')
.segment(handlerName)
if suffix? then uri.segment(suffix)