Commit 9624c00d authored by Pascal's avatar Pascal
Browse files

fix config path

parent 8cbdc0b0
......@@ -25,7 +25,7 @@ When writing ``admin-pages``, consider extending the default
### Adding buttons via configuration
In the file ``configs/admin_extra.ini``
In the file ``configs/admin-extra.ini``
with the following syntax
```
[button.help]
......@@ -39,6 +39,7 @@ html = x
index = 0
scope = dash
```
(these buttons are automatically added)
Use ``scope=server`` to display the button only on display mode,
or ``scope=dash`` to show it only in admin panel (default both)
......
......@@ -60,16 +60,18 @@ class AdminExtraPlugin(Plugin):
self.parse_config()
@serve.bp.before_app_first_request
def setup_blueprint():
app = current_app
app.register_blueprint(utilsbp)
# only if no help pages defined
if self.help_dir is not None:
self.add_button(self.help_dir, 'help', '?', index=0 )
print("[admin-extra] use %s help pages"%self.help_dir)
self.add_button(self.help_dir, 'help', '?' )
else:
self.add_button( url_for('admin_utils.help'), 'help', '?', index=0 )
print("[admin-extra] use default page")
self.add_button( url_for('admin_utils.help'), 'help', '?' )
print("[admin-extra] buttons = %s"%self.right_buttons)
@serve.bp.after_request
#pylint: disable=unused-variable
......@@ -112,7 +114,17 @@ class AdminExtraPlugin(Plugin):
self.help_data['index'].append( (url, item) )
def parse_config(self):
""" register buttons defined in configs/admin-extra.ini """
"""
register buttons defined in configs/admin-extra.ini
Example
```
[button.addpage]
url = /admin/root:add-child
title = nouvelle page
html = +
```
"""
config = self.get_config()
self.help_dir = config.get('help_pages', None)
prefix = 'button.'
......@@ -124,5 +136,3 @@ class AdminExtraPlugin(Plugin):
if get('scope'):
scope = [s for s in get('scope').split(',') if s in ['serve','dash']]
self.add_button(url, title, html, bp=scope, index=index)
......@@ -20,6 +20,9 @@ def onlybranch(branch):
return inner
def pytest_configure(config):
"""
keep name of current test repo
"""
pytest.current_branch = None
pytest.onlybranch = onlybranch
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment