Commit 1e728f26 authored by Pascal's avatar Pascal
Browse files

buttons via config

parent 0c0abd11
# admin-extra
Add facilities for the lektor development server.
This plugin adds buttons and messages facilities to the
[lektor]( development server
and admin panel.
## Flash messages
Flask flash messages are displayed on top of the pages.
## Help pages
......@@ -17,9 +23,31 @@ If ``content/admin-pages`` is not found, the default
When writing ``admin-pages``, consider extending the default
Add extra buttons and messages to lektor admin panel.
### Adding buttons via configuration
Warning: in fact this is not yet implemented.
In the file ``configs/admin_extra.ini``
with the following syntax
url = /admin-pages/
tooltip =
html = ?
url = /logout
tooltip = logout
html = x
index = 0
scope = dash
Use ``scope=server`` to display the button only on display mode,
or ``scope=dash`` to show it only in admin panel (default both)
Use ``index=1`` to show the button in position 1 (index start at 0).
## Adding custom buttons
## Adding buttons with plugins
Besides the default ``?`` help button, the plugin makes it possible
to register other links. For example, the ``lektor-login``
......@@ -45,6 +73,7 @@ started. An option is to register under ``before_app_first_request``
admin_extra.add_button( '/secret/url', 'hidden diary', ':-/' )
## Adding help pages
## How it works
The plugin uses the flask ``after_request`` entrypoint to inject extra html
in all served pages.
......@@ -60,6 +60,14 @@ class AdminExtraPlugin(Plugin):
config = self.get_config()
help_dir = config.get('help_pages', None)
for k,v in config.section_as_dict('button'):
url = v.get('url')
html = v.get('html')
title = v.get('title')
index = v.get('index',None)
scope = [s for s in v.get('scope').split(',') if s in ['serve','dash']]
self.add_button(url, title, html, scope, index=index)
def setup_blueprint():
app = current_app
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