mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-09-03 20:52:57 -05:00
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:
@@ -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 }}
|
||||
@@ -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')
|
||||
Reference in New Issue
Block a user