From e2832351ed2e06f22c8f2098f2454af2142f7166 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Fri, 13 Feb 2015 15:19:08 +0000 Subject: [PATCH] Miscellaneous fixes and cleanups. --- web/pgadmin/about/browser.py | 9 ++++--- .../templates/about/{browser.js => about.js} | 11 --------- web/pgadmin/about/views.py | 10 +++++++- .../browser/templates/browser/index.html | 24 +++++++------------ web/pgadmin/redirects/views.py | 5 ++++ web/pgadmin/settings/browser.py | 9 ++++--- .../settings/{browser.js => settings.js} | 0 web/pgadmin/settings/views.py | 10 +++++++- web/pgadmin/templates/base.html | 6 ++--- 9 files changed, 41 insertions(+), 43 deletions(-) rename web/pgadmin/about/templates/about/{browser.js => about.js} (75%) rename web/pgadmin/settings/templates/settings/{browser.js => settings.js} (100%) diff --git a/web/pgadmin/about/browser.py b/web/pgadmin/about/browser.py index ad7a54f55..46e9b56a1 100644 --- a/web/pgadmin/about/browser.py +++ b/web/pgadmin/about/browser.py @@ -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") \ No newline at end of file + +def get_scripts(): + """Return a list of script URLs to include in the rendered page header""" + return [ url_for('about.script') ] \ No newline at end of file diff --git a/web/pgadmin/about/templates/about/browser.js b/web/pgadmin/about/templates/about/about.js similarity index 75% rename from web/pgadmin/about/templates/about/browser.js rename to web/pgadmin/about/templates/about/about.js index ee8311cd8..30591df30 100644 --- a/web/pgadmin/about/templates/about/browser.js +++ b/web/pgadmin/about/templates/about/about.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() { if (!alertify.aboutDialog) { alertify.dialog('aboutDialog', function factory() { diff --git a/web/pgadmin/about/views.py b/web/pgadmin/about/views.py index 9115f50dc..44732df26 100644 --- a/web/pgadmin/about/views.py +++ b/web/pgadmin/about/views.py @@ -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") \ No newline at end of file diff --git a/web/pgadmin/browser/templates/browser/index.html b/web/pgadmin/browser/templates/browser/index.html index 0b4f41236..4f0508bda 100644 --- a/web/pgadmin/browser/templates/browser/index.html +++ b/web/pgadmin/browser/templates/browser/index.html @@ -19,37 +19,29 @@