diff --git a/web/pgadmin/browser/templates/browser/body.html b/web/pgadmin/browser/templates/browser/body.html index 42c774e2b..282691953 100644 --- a/web/pgadmin/browser/templates/browser/body.html +++ b/web/pgadmin/browser/templates/browser/body.html @@ -1,12 +1,3 @@ - - - - - - - - -
diff --git a/web/pgadmin/browser/views.py b/web/pgadmin/browser/views.py index 06a202b6e..c9ecc73fd 100644 --- a/web/pgadmin/browser/views.py +++ b/web/pgadmin/browser/views.py @@ -10,7 +10,7 @@ """A blueprint module implementing the core pgAdmin browser.""" MODULE_NAME = 'browser' -from flask import Blueprint, current_app, render_template +from flask import Blueprint, current_app, render_template, url_for from flaskext.gravatar import Gravatar from flask.ext.security import login_required from flask.ext.login import current_user @@ -45,7 +45,19 @@ def index(): edit_items = [ ] tools_items = [ ] help_items = [ ] - js_code = '' + stylesheets = [ ] + scripts = [ ] + + # Add browser stylesheets + stylesheets.append(url_for('static', filename='css/codemirror/codemirror.css')) + stylesheets.append(url_for('browser.static', filename='css/browser.css')) + stylesheets.append(url_for('browser.static', filename='css/aciTree/css/aciTree.css')) + + # Add browser scripts + scripts.append(url_for('static', filename='js/codemirror/codemirror.js')) + scripts.append(url_for('static', filename='js/codemirror/mode/sql.js')) + scripts.append(url_for('browser.static', filename='js/aciTree/jquery.aciPlugin.min.js')) + scripts.append(url_for('browser.static', filename='js/aciTree/jquery.aciTree.min.js')) for module in modules: # Get the edit menu items @@ -63,10 +75,14 @@ def index(): # Get the help menu items if 'browser' in dir(module) and 'get_help_menu_items' in dir(module.browser): help_items.extend(module.browser.get_help_menu_items()) - - # Get any Javascript code - if 'browser' in dir(module) and 'get_javascript_code' in dir(module.browser): - js_code += (module.browser.get_javascript_code()) + + # Get any stylesheets + if 'browser' in dir(module) and 'get_stylesheets' in dir(module.browser): + stylesheets += module.browser.get_stylesheets() + + # Get any scripts + if 'browser' in dir(module) and 'get_scripts' in dir(module.browser): + scripts += module.browser.get_scripts() file_items = sorted(file_items, key=lambda k: k['priority']) edit_items = sorted(edit_items, key=lambda k: k['priority']) @@ -74,7 +90,7 @@ def index(): help_items = sorted(help_items, key=lambda k: k['priority']) # Get the layout settings - layout_settings = {} + layout_settings = { } layout_settings['sql_size'] = get_setting('Browser/SQLPane/Size', default=250) layout_settings['sql_closed'] = get_setting('Browser/SQLPane/Closed', default="false") layout_settings['browser_size'] = get_setting('Browser/BrowserPane/Size', default=250) @@ -86,5 +102,6 @@ def index(): edit_items=edit_items, tools_items=tools_items, help_items=help_items, - js_code = js_code, + stylesheets = stylesheets, + scripts = scripts, layout_settings = layout_settings) diff --git a/web/pgadmin/static/js/alertifyjs/pgadmin.defaults.js b/web/pgadmin/static/js/alertifyjs/pgadmin.defaults.js new file mode 100644 index 000000000..e32e2972a --- /dev/null +++ b/web/pgadmin/static/js/alertifyjs/pgadmin.defaults.js @@ -0,0 +1,4 @@ +alertify.defaults.transition = "zoom"; +alertify.defaults.theme.ok = "btn btn-primary"; +alertify.defaults.theme.cancel = "btn btn-danger"; +alertify.defaults.theme.input = "form-control"; \ No newline at end of file diff --git a/web/pgadmin/templates/base.html b/web/pgadmin/templates/base.html index d1ff45c70..e67babe1d 100755 --- a/web/pgadmin/templates/base.html +++ b/web/pgadmin/templates/base.html @@ -14,41 +14,42 @@ + {% if config.DEBUG %}{% else %}{% endif %} {% if config.DEBUG %}{% else %}{% endif %} {% if config.DEBUG %}{% else %}{% endif %} {% if config.DEBUG %}{% else %}{% endif %} - {% if config.DEBUG %}{% else %}{% endif %} - + {% if stylesheets is defined %} + + {% for stylesheet in stylesheets %} + + {% endfor %} + {% endif %} + + + {% if config.DEBUG %} + {% if config.DEBUG %} + {% if config.DEBUG %} + + {% if config.DEBUG %} + {% if config.DEBUG %} + + {% if scripts is defined %} + + {% for script in scripts %} + + {% endfor %} + {% endif %} - {% if config.DEBUG %} - {% if config.DEBUG %} - {% if config.DEBUG %} - {% if config.DEBUG %} - {% if config.DEBUG %} - - - - {% block body %}{% endblock %} diff --git a/web/pgadmin/test/browser.py b/web/pgadmin/test/browser.py index 8186bb780..933fe7cf3 100644 --- a/web/pgadmin/test/browser.py +++ b/web/pgadmin/test/browser.py @@ -22,7 +22,6 @@ def get_file_menu_items(): {'name': 'Test Notifier', 'priority': 600, 'url': '#', 'onclick': 'test_notifier()'}, ] -def get_javascript_code(): - """Render from the template and return any Javascript code snippets required - in the browser""" - return render_template("test/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('test.static', filename='js/test.js') ] \ No newline at end of file diff --git a/web/pgadmin/test/templates/test/browser.js b/web/pgadmin/test/static/js/test.js similarity index 91% rename from web/pgadmin/test/templates/test/browser.js rename to web/pgadmin/test/static/js/test.js index 76e2fb9b9..2910de3cb 100644 --- a/web/pgadmin/test/templates/test/browser.js +++ b/web/pgadmin/test/static/js/test.js @@ -1,13 +1,11 @@ -{# -########################################################################## -# -# pgAdmin 4 - PostgreSQL Tools -# -# Copyright (C) 2013 - 2014, The pgAdmin Development Team -# This software is released under the PostgreSQL Licence -# -########################################################################## -#} +//////////////////////////////////////////////////////////////////////////////// +// +// pgAdmin 4 - PostgreSQL Tools +// +// Copyright (C) 2013 - 2014, The pgAdmin Development Team +// This software is released under the PostgreSQL Licence +// +//////////////////////////////////////////////////////////////////////////////// function test_alert() { alertify.alert(