comparison piecrust/admin/views/__init__.py @ 961:b1a00c2c0c7f

admin: Use URL routes for static assets. This removes the need for `base_url` and other workarounds for when the admin panel is under a sub-folder.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 07 Oct 2017 12:16:04 -0700
parents 7ecb946bfafd
children
comparison
equal deleted inserted replaced
960:8101692fdc11 961:b1a00c2c0c7f
22 22
23 def with_menu_context(context=None): 23 def with_menu_context(context=None):
24 if context is None: 24 if context is None:
25 context = {} 25 context = {}
26 context['menu'] = get_menu_context() 26 context['menu'] = get_menu_context()
27 with_base_data(context)
28 return context 27 return context
29
30
31 def with_base_data(context=None):
32 if context is None:
33 context = {}
34
35 script_root = request.script_root or ''
36 root_url = current_app.config.get('FOODTRUCK_ROOT_URL') or ''
37 context['base_url'] = script_root + root_url