Add automatic browser menu integration for modules.

Modules may now include functions that return lists of menu items
that will be included on the main browser window menu. While we're
at it, move the test views into a separate module.
This commit is contained in:
Dave Page
2015-01-27 14:18:27 +00:00
parent 0cff5fca2c
commit d492da3ca1
11 changed files with 176 additions and 25 deletions
View File
+18
View File
@@ -0,0 +1,18 @@
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2014, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
"""Browser integration functions for the About module."""
from flask import url_for
import config
def get_help_menu_items():
"""Return a (set) of dicts of help menu items, with name, priority and URL."""
return [{'name': 'About %s' % (config.APP_NAME), 'priority': 999, 'url': url_for('about.index')}]
@@ -0,0 +1 @@
About {{ config.APP_NAME }}
+27
View File
@@ -0,0 +1,27 @@
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2014, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
"""A blueprint module implementing the about box."""
MODULE_NAME = 'about'
import config
from flask import Blueprint, current_app, render_template
from flask.ext.security import login_required
# Initialise the module
blueprint = Blueprint(MODULE_NAME, __name__, static_folder='static', static_url_path='', template_folder='templates', url_prefix='/' + MODULE_NAME)
##########################################################################
# A test page
##########################################################################
@blueprint.route("/")
@login_required
def index():
"""Render the about box."""
return render_template(MODULE_NAME + '/index.html')