backoffice: add jsonp support to backoffice/menu.json endpoint (#7146)
This commit is contained in:
parent
1be0db51de
commit
a1ce36d3e5
|
@ -208,7 +208,12 @@ class RootDirectory(BackofficeRootDirectory):
|
||||||
get_response().set_header('Access-Control-Allow-Headers', 'x-requested-with')
|
get_response().set_header('Access-Control-Allow-Headers', 'x-requested-with')
|
||||||
menu_items = []
|
menu_items = []
|
||||||
backoffice_url = get_publisher().get_backoffice_url()
|
backoffice_url = get_publisher().get_backoffice_url()
|
||||||
return json.dumps(self.get_menu_items())
|
json_str = json.dumps(self.get_menu_items())
|
||||||
|
for variable in ('jsonpCallback', 'callback'):
|
||||||
|
if variable in get_request().form:
|
||||||
|
json_str = '%s(%s);' % (get_request().form[variable], json_str)
|
||||||
|
break
|
||||||
|
return json_str
|
||||||
|
|
||||||
def pending(self):
|
def pending(self):
|
||||||
# kept as a redirection for compatibility with possible bookmarks
|
# kept as a redirection for compatibility with possible bookmarks
|
||||||
|
|
Loading…
Reference in New Issue