From a3af450d38cde2750778aefe148d4f7f2e2abc2e Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <renaud.legac@free.fr> Date: Wed, 15 Feb 2012 21:49:25 +0100 Subject: [PATCH] Finalize the debug controller and remove the debug view. --- controllers/plugin_dbui.py | 66 ++++++++++++++++-------------------- views/plugin_dbui/index.html | 2 +- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/controllers/plugin_dbui.py b/controllers/plugin_dbui.py index e0375b7a..29645428 100644 --- a/controllers/plugin_dbui.py +++ b/controllers/plugin_dbui.py @@ -108,34 +108,28 @@ def debug(): """ # check the presence of the ExtJS and MathJax plugins dbui = local_import('plugin_dbui') - pextjs = dbui.get_plugin_path('plugin_extjs') - pmathjax = dbui.get_plugin_path('plugin_mathjax') - - # internationalization (fr, fr-fr, fr-ca, ...) - lg = dbui.get_language() - - # dbui javascript source code -- respect the alphabetic order - response.files.extend(dbui.get_files('static/plugin_dbui/src', - ext='.js', - alpha=True)) - - # user javascript source code -- respect the alphabetic order - response.files.extend(dbui.get_files(plugins.dbui.user_src_path, - ext='.js', - alpha=True)) - - # main script - # keep in mind that the script can be selected from the url - # using the argument script=foo - pscript = dbui.get_script_path(plugins.dbui.script_path) + plugin = plugins.dbui + + # plugin and application css files + response.files.extend(dbui.get_file_paths(plugin.base_css, ext='.css')) + response.files.extend(dbui.get_file_paths(plugin.app_css, ext='.css')) + + # plugin and application javascript source code + response.files.extend(dbui.get_file_paths(plugin.base_js_dir, ext='.js')) + response.files.extend(dbui.get_file_paths(plugin.app_js_dir, ext='.js')) + + # main script which can be defined in many different ways + pscript = dbui.get_script_path(plugin) response.files.append(pscript) # switch ON the debug mode on the server side session.debug = True + + # select the view + response.view = 'plugin_dbui/index.html' - # return the ExtJS path, the language - # and a list of files in response.files - return dict(pextjs=pextjs, pmathjax=pmathjax, lg=lg) + # return the plugin configuration parameter as well as the response + return dict(plugin=plugin) @@ -212,28 +206,28 @@ def index(): is launched. """ - # check the presence of the ExtJS and MathJax plugins dbui = local_import('plugin_dbui') - pextjs = dbui.get_plugin_path('plugin_extjs') - pmathjax = dbui.get_plugin_path('plugin_mathjax') + plugin = plugins.dbui - # internationalization (fr, fr-fr, fr-ca, ...) - lg = dbui.get_language() + # plugin and application css files + response.files.extend(dbui.get_file_paths(plugin.base_css, ext='.css')) + response.files.extend(dbui.get_file_paths(plugin.app_css, ext='.css')) - # compressed version of the user library - response.files.extend(dbui.get_files(plugins.dbui.user_libmin)) + # compressed version of the plugin javascript libraries + response.files.extend(dbui.get_file_paths(plugin.base_libmin, ext='.js')) + + # compressed version of the application javascript library + response.files.extend(dbui.get_file_paths(plugin.app_libmin, ext='.js')) - # main script - # keep in mind that the script can be selected from the url - # using the argument script=foo - pscript = dbui.get_script_path(plugins.dbui.script_path) + # main script which can be defined in many different ways + pscript = dbui.get_script_path(plugin) response.files.append(pscript) # switch off the debug mode on the server side session.debug = False - # return the ExtJS, MathJax paths and the language - return dict(pextjs=pextjs, pmathjax=pmathjax, lg=lg) + # return the plugin configuration parameter as well as the response + return dict(plugin=plugin) def status(): diff --git a/views/plugin_dbui/index.html b/views/plugin_dbui/index.html index cbdd9ede..da411951 100644 --- a/views/plugin_dbui/index.html +++ b/views/plugin_dbui/index.html @@ -27,7 +27,7 @@ <!-- extjs + dbui + application css --> <link rel="stylesheet" type="text/css" href="{{=plugin.base_pextjs}}/resources/css/ext-all.css"/> - {{for el in response.files:}}{{if el.endswith('.css'):}}<link rel="stylesheet" type="text/css" href="{{=el}}"/>{{pass}} + {{for el in response.files:}}{{if el.endswith('.css'):}}<link rel="stylesheet" type="text/css" href="{{=el}}"/>{{else: continue}}{{pass}} {{pass}} <!-- extjs javascript library --> -- GitLab