Update handler_url support to match the latest in the xblock repo, for both js and python runtimes

[LMS-1613]
This commit is contained in:
Calen Pennington
2013-11-18 11:31:08 -05:00
parent 0d3d7588bf
commit d937da8d47
4 changed files with 79 additions and 8 deletions

View File

@@ -4,9 +4,21 @@
childMap[child.name] = child
return {
handlerUrl: (handlerName) ->
# Generate the handler url for the specified handler.
#
# element is the html element containing the xblock requesting the url
# handlerName is the name of the handler
# suffix is the optional url suffix to include in the handler url
# query is an optional query-string (note, this should not include a preceding ? or &)
handlerUrl: (element, handlerName, suffix, query) ->
handlerPrefix = $(element).data("handler-prefix")
"#{handlerPrefix}/#{handlerName}"
suffix = if suffix? then "/#{suffix}" else ''
query = if query? then "?#{query}" else ''
"#{handlerPrefix}/#{handlerName}#{suffix}#{query}"
# A list of xblock children of this element
children: children
# A map of name -> child for the xblock children of this element
childMap: childMap
}