mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-08 15:13:10 -06:00
Miscellaneous fixes and cleanups.
This commit is contained in:
parent
b5abf2c640
commit
e2832351ed
@ -20,8 +20,7 @@ def get_help_menu_items():
|
|||||||
'priority': 999,
|
'priority': 999,
|
||||||
'url': "#",
|
'url': "#",
|
||||||
'onclick': "about_show()"}]
|
'onclick': "about_show()"}]
|
||||||
|
|
||||||
def get_javascript_code():
|
def get_scripts():
|
||||||
"""Render from the template and return any Javascript code snippets required
|
"""Return a list of script URLs to include in the rendered page header"""
|
||||||
in the browser"""
|
return [ url_for('about.script') ]
|
||||||
return render_template("about/browser.js")
|
|
@ -1,14 +1,3 @@
|
|||||||
{#
|
|
||||||
##########################################################################
|
|
||||||
#
|
|
||||||
# pgAdmin 4 - PostgreSQL Tools
|
|
||||||
#
|
|
||||||
# Copyright (C) 2013 - 2014, The pgAdmin Development Team
|
|
||||||
# This software is released under the PostgreSQL Licence
|
|
||||||
#
|
|
||||||
##########################################################################
|
|
||||||
#}
|
|
||||||
|
|
||||||
function about_show() {
|
function about_show() {
|
||||||
if (!alertify.aboutDialog) {
|
if (!alertify.aboutDialog) {
|
||||||
alertify.dialog('aboutDialog', function factory() {
|
alertify.dialog('aboutDialog', function factory() {
|
@ -10,7 +10,7 @@
|
|||||||
"""A blueprint module implementing the about box."""
|
"""A blueprint module implementing the about box."""
|
||||||
MODULE_NAME = 'about'
|
MODULE_NAME = 'about'
|
||||||
|
|
||||||
from flask import Blueprint, current_app, render_template, __version__
|
from flask import Blueprint, Response, current_app, render_template, __version__
|
||||||
from flask.ext.security import current_user, login_required
|
from flask.ext.security import current_user, login_required
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@ -37,3 +37,11 @@ def index():
|
|||||||
info['current_user'] = current_user.email
|
info['current_user'] = current_user.email
|
||||||
|
|
||||||
return render_template(MODULE_NAME + '/index.html', info=info)
|
return render_template(MODULE_NAME + '/index.html', info=info)
|
||||||
|
|
||||||
|
@blueprint.route("/about.js")
|
||||||
|
@login_required
|
||||||
|
def script():
|
||||||
|
"""Render the required Javascript"""
|
||||||
|
return Response(response=render_template("about/about.js"),
|
||||||
|
status=200,
|
||||||
|
mimetype="application/javascript")
|
@ -19,37 +19,29 @@
|
|||||||
|
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">File <span class="caret"></span></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">File <span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">{% for file_item in file_items %}
|
||||||
{% for file_item in file_items %}
|
<li><a href="{{ file_item.url }}" onclick="{{ file_item.onclick|safe }}">{{ file_item.name }}</a></li>{% endfor %}
|
||||||
<li><a href="{{ file_item.url }}" onclick="{{ file_item.onclick|safe }}">{{ file_item.name }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Edit <span class="caret"></span></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Edit <span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">{% for edit_item in edit_items %}
|
||||||
{% for edit_item in edit_items %}
|
<li><a href="{{ edit_item.url }}" onclick="{{ edit_item.onclick|safe }}">{{ edit_item.name }}</a></li>{% endfor %}
|
||||||
<li><a href="{{ edit_item.url }}" onclick="{{ edit_item.onclick|safe }}">{{ edit_item.name }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Tools <span class="caret"></span></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Tools <span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">{% for tools_item in tools_items %}
|
||||||
{% for tools_item in tools_items %}
|
<li><a href="{{ tools_item.url }}" onclick="{{ tools_item.onclick|safe }}">{{ tools_item.name }}</a></li>{% endfor %}
|
||||||
<li><a href="{{ tools_item.url }}" onclick="{{ tools_item.onclick|safe }}">{{ tools_item.name }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Help <span class="caret"></span></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Help <span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">{% for help_item in help_items %}
|
||||||
{% for help_item in help_items %}
|
<li><a href="{{ help_item.url }}" onclick="{{ help_item.onclick|safe }}">{{ help_item.name }}</a></li>{% endfor %}
|
||||||
<li><a href="{{ help_item.url }}" onclick="{{ help_item.onclick|safe }}">{{ help_item.name }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
@ -22,3 +22,8 @@ blueprint = Blueprint(MODULE_NAME, __name__)
|
|||||||
def index():
|
def index():
|
||||||
"""Redirect users hitting the root to the browser"""
|
"""Redirect users hitting the root to the browser"""
|
||||||
return redirect(url_for('browser.index'))
|
return redirect(url_for('browser.index'))
|
||||||
|
|
||||||
|
@blueprint.route('/favicon.ico')
|
||||||
|
def favicon():
|
||||||
|
"""Redirect to the favicon"""
|
||||||
|
return redirect(url_for('static', filename='favicon.ico'))
|
||||||
|
@ -9,9 +9,8 @@
|
|||||||
|
|
||||||
"""Browser integration functions for settings."""
|
"""Browser integration functions for settings."""
|
||||||
|
|
||||||
from flask import render_template
|
from flask import url_for
|
||||||
|
|
||||||
def get_javascript_code():
|
def get_scripts():
|
||||||
"""Render from the template and return any Javascript code snippets required
|
"""Return a list of script URLs to include in the rendered page header"""
|
||||||
in the browser"""
|
return [ url_for('settings.script') ]
|
||||||
return render_template("settings/browser.js")
|
|
@ -11,7 +11,7 @@
|
|||||||
MODULE_NAME = 'settings'
|
MODULE_NAME = 'settings'
|
||||||
|
|
||||||
import config
|
import config
|
||||||
from flask import Blueprint, Response, abort, request
|
from flask import Blueprint, Response, abort, request, render_template
|
||||||
from flask.ext.security import login_required
|
from flask.ext.security import login_required
|
||||||
|
|
||||||
from . import get_setting, store_setting
|
from . import get_setting, store_setting
|
||||||
@ -19,6 +19,14 @@ from . import get_setting, store_setting
|
|||||||
# Initialise the module
|
# Initialise the module
|
||||||
blueprint = Blueprint(MODULE_NAME, __name__, template_folder='templates', url_prefix='/' + MODULE_NAME)
|
blueprint = Blueprint(MODULE_NAME, __name__, template_folder='templates', url_prefix='/' + MODULE_NAME)
|
||||||
|
|
||||||
|
@blueprint.route("/settings.js")
|
||||||
|
@login_required
|
||||||
|
def script():
|
||||||
|
"""Render the required Javascript"""
|
||||||
|
return Response(response=render_template("settings/settings.js"),
|
||||||
|
status=200,
|
||||||
|
mimetype="application/javascript")
|
||||||
|
|
||||||
@blueprint.route("/store", methods=['POST'])
|
@blueprint.route("/store", methods=['POST'])
|
||||||
@blueprint.route("/store/<setting>/<value>", methods=['GET'])
|
@blueprint.route("/store/<setting>/<value>", methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
{% if stylesheets is defined %}
|
{% if stylesheets is defined %}
|
||||||
<!-- View specified stylesheets -->
|
<!-- View specified stylesheets -->
|
||||||
{% for stylesheet in stylesheets %}
|
{% for stylesheet in stylesheets %}
|
||||||
<link rel="stylesheet" href="{{ stylesheet }}">
|
<link rel="stylesheet" href="{{ stylesheet }}">{% endfor %}
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Base template scripts -->
|
<!-- Base template scripts -->
|
||||||
@ -41,8 +40,7 @@
|
|||||||
{% if scripts is defined %}
|
{% if scripts is defined %}
|
||||||
<!-- View specified scripts -->
|
<!-- View specified scripts -->
|
||||||
{% for script in scripts %}
|
{% for script in scripts %}
|
||||||
<script src="{{ script }}"></script>
|
<script src="{{ script }}"></script>{% endfor %}
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
Reference in New Issue
Block a user