From 2e01bfda48dfa39c21e7df7f59819a0c1dc5b70f Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <renaud.legac@free.fr> Date: Wed, 15 Dec 2010 18:39:32 +0000 Subject: [PATCH] Modify to run with minified version of the library. --- controllers/plugin_dbui.py | 24 +++++++++++++++--------- views/plugin_dbui.html | 3 ++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/controllers/plugin_dbui.py b/controllers/plugin_dbui.py index 905da12a..e05c35ee 100644 --- a/controllers/plugin_dbui.py +++ b/controllers/plugin_dbui.py @@ -115,15 +115,21 @@ def index(): if len(lg) == 5 and lg[0:2] == lg[3:5]: lg = lg[0:2] response.files.append(os.path.join(extjs, 'src', 'locale', 'ext-lang-%s.js' % lg)) - # plugin libraries -- respect the alphabetic order - li = [] - appjs = os.path.join(base, 'static', 'plugin_dbui', 'lib') - for file in os.listdir(os.path.join(server_path, 'static', 'plugin_dbui', 'lib')): - if file.endswith(".js"): - li.append(os.path.join(appjs, file)) - - li.sort() - response.files.extend(li) + # plugin library -- the minified version + path = os.path.join(server_path, 'static', 'plugin_dbui', 'dbui-all.js') + if not debug and os.path.exists(path): + response.files.append(os.path.join(base, 'static', 'plugin_dbui', 'dbui-all.js')) + + # plugin libraries -- full version -- respect the alphabetic order + else: + li = [] + appjs = os.path.join(base, 'static', 'plugin_dbui', 'lib') + for file in os.listdir(os.path.join(server_path, 'static', 'plugin_dbui', 'lib')): + if file.endswith(".js"): + li.append(os.path.join(appjs, file)) + + li.sort() + response.files.extend(li) # main application script response.files.append(os.path.join(base, plugins.dbui.script_path, script)) diff --git a/views/plugin_dbui.html b/views/plugin_dbui.html index e053900c..5976d924 100644 --- a/views/plugin_dbui.html +++ b/views/plugin_dbui.html @@ -14,11 +14,12 @@ if el.endswith('css'):}}<link rel="stylesheet" type="text/css" href="{{=el}}"/> - {{elif el.endswith('appbase.js'):}} + {{elif el.endswith('appbase.js') or el.endswith('dbui-all.js'):}} <script type="text/javascript"> Ext.namespace('App'); App.name = '{{=request.application}}'; App.debug = {{=str(debug).lower()}}; + App.withMathJax = {{=str(withMathJax).lower()}}; </script> <script type="text/javascript" src="{{=el}}"></script> -- GitLab