mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-07 22:53:45 -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,
|
||||
'url': "#",
|
||||
'onclick': "about_show()"}]
|
||||
|
||||
def get_javascript_code():
|
||||
"""Render from the template and return any Javascript code snippets required
|
||||
in the browser"""
|
||||
return render_template("about/browser.js")
|
||||
|
||||
def get_scripts():
|
||||
"""Return a list of script URLs to include in the rendered page header"""
|
||||
return [ url_for('about.script') ]
|
@ -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() {
|
||||
if (!alertify.aboutDialog) {
|
||||
alertify.dialog('aboutDialog', function factory() {
|
@ -10,7 +10,7 @@
|
||||
"""A blueprint module implementing the about box."""
|
||||
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
|
||||
|
||||
import sys
|
||||
@ -37,3 +37,11 @@ def index():
|
||||
info['current_user'] = current_user.email
|
||||
|
||||
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">
|
||||
<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">
|
||||
{% for file_item in file_items %}
|
||||
<li><a href="{{ file_item.url }}" onclick="{{ file_item.onclick|safe }}">{{ file_item.name }}</a></li>
|
||||
{% endfor %}
|
||||
<ul class="dropdown-menu" role="menu">{% for file_item in file_items %}
|
||||
<li><a href="{{ file_item.url }}" onclick="{{ file_item.onclick|safe }}">{{ file_item.name }}</a></li>{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<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">
|
||||
{% for edit_item in edit_items %}
|
||||
<li><a href="{{ edit_item.url }}" onclick="{{ edit_item.onclick|safe }}">{{ edit_item.name }}</a></li>
|
||||
{% endfor %}
|
||||
<ul class="dropdown-menu" role="menu">{% for edit_item in edit_items %}
|
||||
<li><a href="{{ edit_item.url }}" onclick="{{ edit_item.onclick|safe }}">{{ edit_item.name }}</a></li>{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<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">
|
||||
{% for tools_item in tools_items %}
|
||||
<li><a href="{{ tools_item.url }}" onclick="{{ tools_item.onclick|safe }}">{{ tools_item.name }}</a></li>
|
||||
{% endfor %}
|
||||
<ul class="dropdown-menu" role="menu">{% for tools_item in tools_items %}
|
||||
<li><a href="{{ tools_item.url }}" onclick="{{ tools_item.onclick|safe }}">{{ tools_item.name }}</a></li>{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<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">
|
||||
{% for help_item in help_items %}
|
||||
<li><a href="{{ help_item.url }}" onclick="{{ help_item.onclick|safe }}">{{ help_item.name }}</a></li>
|
||||
{% endfor %}
|
||||
<ul class="dropdown-menu" role="menu">{% for help_item in help_items %}
|
||||
<li><a href="{{ help_item.url }}" onclick="{{ help_item.onclick|safe }}">{{ help_item.name }}</a></li>{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
@ -22,3 +22,8 @@ blueprint = Blueprint(MODULE_NAME, __name__)
|
||||
def index():
|
||||
"""Redirect users hitting the root to the browser"""
|
||||
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."""
|
||||
|
||||
from flask import render_template
|
||||
from flask import url_for
|
||||
|
||||
def get_javascript_code():
|
||||
"""Render from the template and return any Javascript code snippets required
|
||||
in the browser"""
|
||||
return render_template("settings/browser.js")
|
||||
def get_scripts():
|
||||
"""Return a list of script URLs to include in the rendered page header"""
|
||||
return [ url_for('settings.script') ]
|
@ -11,7 +11,7 @@
|
||||
MODULE_NAME = 'settings'
|
||||
|
||||
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 . import get_setting, store_setting
|
||||
@ -19,6 +19,14 @@ from . import get_setting, store_setting
|
||||
# Initialise the module
|
||||
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/<setting>/<value>", methods=['GET'])
|
||||
@login_required
|
||||
|
@ -25,8 +25,7 @@
|
||||
{% if stylesheets is defined %}
|
||||
<!-- View specified stylesheets -->
|
||||
{% for stylesheet in stylesheets %}
|
||||
<link rel="stylesheet" href="{{ stylesheet }}">
|
||||
{% endfor %}
|
||||
<link rel="stylesheet" href="{{ stylesheet }}">{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Base template scripts -->
|
||||
@ -41,8 +40,7 @@
|
||||
{% if scripts is defined %}
|
||||
<!-- View specified scripts -->
|
||||
{% for script in scripts %}
|
||||
<script src="{{ script }}"></script>
|
||||
{% endfor %}
|
||||
<script src="{{ script }}"></script>{% endfor %}
|
||||
{% endif %}
|
||||
</head>
|
||||
<body>
|
||||
|
Loading…
Reference in New Issue
Block a user