From 68131cbf61cdde63d1c263ed5668f727fceb67b4 Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Mon, 8 Sep 2008 11:08:03 -0700 Subject: Rewrite of toolbar HTML, CSS, and JS. Written by David Cramer with some tweaks. This also removes the jQuery dependency. --- README.rst | 6 -- debug_toolbar/middleware.py | 4 +- debug_toolbar/templates/debug_toolbar/base.html | 80 ++++++++++++++-------- .../templates/debug_toolbar/panels/http_vars.html | 4 +- 4 files changed, 54 insertions(+), 40 deletions(-) diff --git a/README.rst b/README.rst index ce8a762..5d56eb9 100644 --- a/README.rst +++ b/README.rst @@ -53,14 +53,8 @@ Installation #. Add `debug_toolbar` to your `INSTALLED_APPS` setting so Django can find the the template files associated with the Debug Toolbar. -#. The UI effects of the Toolbar currently depend on jQuery to be already - included in your templates. So currently to test out the toolbar jQuery - already needs to be loaded on the page. We'll need a solution for this at - some point. - TODO ==== - Panel idea: Show some commonly used settings from settings.py - Panel idea: AJAX call to show cprofile data similar to the ?prof idea - CSS Stylings -- Remove dependency on jQuery and come up with a general workable solution. diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index 8883b37..7cfaac6 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -8,7 +8,7 @@ from debug_toolbar.toolbar.loader import DebugToolbar _HTML_TYPES = ('text/html', 'application/xhtml+xml') _END_HEAD_RE = re.compile(r'', re.IGNORECASE) -_END_BODY_RE = re.compile(r'
', re.IGNORECASE) class DebugToolbarMiddleware(object): """ @@ -36,5 +36,5 @@ class DebugToolbarMiddleware(object): if response['Content-Type'].split(';')[0] in _HTML_TYPES and not request.is_ajax(): # Saving this here in case we ever need to inject into #response.content = _END_HEAD_RE.sub(smart_str(self.debug_toolbar.render_styles() + "%s" % match.group()), response.content) - response.content = _END_BODY_RE.sub(smart_str(self.debug_toolbar.render_toolbar() + ''), response.content) + response.content = _END_BODY_RE.sub(smart_str('' + self.debug_toolbar.render_toolbar()), response.content) return response diff --git a/debug_toolbar/templates/debug_toolbar/base.html b/debug_toolbar/templates/debug_toolbar/base.html index 9ebf9cc..7488b92 100644 --- a/debug_toolbar/templates/debug_toolbar/base.html +++ b/debug_toolbar/templates/debug_toolbar/base.html @@ -1,45 +1,65 @@ -