Add page/way to configure main menus
just the basics so far, index page routes and separators should be supported but nothing else. also "menus from config" is all or nothing, no way to mix config + code at this point
This commit is contained in:
parent
587a4daf7a
commit
74fecf553e
7 changed files with 883 additions and 25 deletions
|
@ -156,19 +156,33 @@ def make_pyramid_config(settings, configure_csrf=True):
|
|||
config.add_directive('add_tailbone_permission_group', 'tailbone.auth.add_permission_group')
|
||||
config.add_directive('add_tailbone_permission', 'tailbone.auth.add_permission')
|
||||
|
||||
# and some similar magic for config views
|
||||
# and some similar magic for certain master views
|
||||
config.add_directive('add_tailbone_index_page', 'tailbone.app.add_index_page')
|
||||
config.add_directive('add_tailbone_config_page', 'tailbone.app.add_config_page')
|
||||
|
||||
return config
|
||||
|
||||
|
||||
def add_config_page(config, route_name, label):
|
||||
def add_index_page(config, route_name, label, permission):
|
||||
"""
|
||||
Register a config page for the app.
|
||||
"""
|
||||
def action():
|
||||
pages = config.get_settings().get('tailbone_index_pages', [])
|
||||
pages.append({'label': label, 'route': route_name,
|
||||
'permission': permission})
|
||||
config.add_settings({'tailbone_index_pages': pages})
|
||||
config.action(None, action)
|
||||
|
||||
|
||||
def add_config_page(config, route_name, label, permission):
|
||||
"""
|
||||
Register a config page for the app.
|
||||
"""
|
||||
def action():
|
||||
pages = config.get_settings().get('tailbone_config_pages', [])
|
||||
pages.append({'label': label, 'route': route_name})
|
||||
pages.append({'label': label, 'route': route_name,
|
||||
'permission': permission})
|
||||
config.add_settings({'tailbone_config_pages': pages})
|
||||
config.action(None, action)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue