0001-backoffice-export-list-of-menu-items-as-json-7146.patch
wcs/backoffice/root.py | ||
---|---|---|
453 | 453 | |
454 | 454 | |
455 | 455 |
class RootDirectory(BackofficeRootDirectory): |
456 |
_q_exports = ['', 'pending', 'statistics'] |
|
456 |
_q_exports = ['', 'pending', 'statistics', ('menu.json', 'menu_json')]
|
|
457 | 457 | |
458 | 458 |
bounces = wcs.admin.bounces.BouncesDirectory() |
459 | 459 |
categories = wcs.admin.categories.CategoriesDirectory() |
... | ... | |
581 | 581 | |
582 | 582 |
return r.getvalue() |
583 | 583 | |
584 |
def backoffice_menu(self): |
|
585 |
get_response().set_content_type('application/json') |
|
586 |
if get_request().get_environ('HTTP_ORIGIN'): |
|
587 |
get_response().set_header('Access-Control-Allow-Origin', |
|
588 |
get_request().get_environ('HTTP_ORIGIN')) |
|
589 |
get_response().set_header('Access-Control-Allow-Credentials', 'true') |
|
590 |
get_response().set_header('Access-Control-Allow-Headers', 'x-requested-with') |
|
591 |
menu_items = [] |
|
592 |
backoffice_url = get_publisher().get_backoffice_url() |
|
593 |
return json.dumps(self.get_menu_items()) |
|
594 | ||
584 | 595 |
def pending(self): |
585 | 596 |
# kept as a redirection for compatibility with possible bookmarks |
586 | 597 |
return redirect('.') |
587 |
- |