diff options
| author | Matt George | 2008-09-29 12:30:37 -0500 |
|---|---|---|
| committer | Matt George | 2008-09-29 12:30:37 -0500 |
| commit | 4734384cecd18ee6497730dc997aa34040975d13 (patch) | |
| tree | adbbe87fbc1f441e83ea068f19a5128fffd98f09 /debug_toolbar/templates | |
| parent | 2a32669822bddb31f687fcf6ca45f5d82d691e8d (diff) | |
| parent | ce8c68b79c2de4abde01b29b1c73754ce4deb981 (diff) | |
| download | django-debug-toolbar-4734384cecd18ee6497730dc997aa34040975d13.tar.bz2 | |
Merge branch 'master' of git://github.com/robhudson/django-debug-toolbar
Conflicts:
debug_toolbar/templates/debug_toolbar/base.html
Diffstat (limited to 'debug_toolbar/templates')
6 files changed, 96 insertions, 47 deletions
diff --git a/debug_toolbar/templates/debug_toolbar/base.html b/debug_toolbar/templates/debug_toolbar/base.html index d16fc86..88938d9 100644 --- a/debug_toolbar/templates/debug_toolbar/base.html +++ b/debug_toolbar/templates/debug_toolbar/base.html @@ -1,39 +1,11 @@ -<script type="text/javascript"> - var djDebugLastObj = null; - function djDebugToggle(obj) { - if (djDebugLastObj) djDebugLastObj.style.display = 'none'; - var obj = document.getElementById(obj); - if (!obj) return; - if (djDebugLastObj == obj) { - djDebugLastObj = null; - return; - } - if (obj.style.display != 'block') { - obj.style.display = 'block'; - djDebugLastObj = obj; - } - } - function djDebugClose() { - if (!djDebugLastObj) return; - djDebugLastObj.style.display = 'none'; - djDebugLastObj = null; +<script type="text/javascript" charset="utf-8"> + if (typeof jQuery == 'undefined') { + var jquery_url = '{{ BASE_URL }}/__debug__/m/jquery.js'; + document.write(unescape('%3Cscript src="' + jquery_url + '" type="text/javascript"%3E%3C/script%3E')); } </script> <style type="text/css"> - #djDebugToolbar {height:30px; background:#efefef; color:#000; z-index:100000000; border:1px solid #06171D; border-width:1px 0;} - #djDebugToolbar ul {margin:0; padding:0 10px; list-style:none;} - #djDebugToolbar li {display:inline; width:auto; position:relative; float:none; margin:0 10px 0 0; padding:0; height:20px; line-height:30px; padding:8px 10px 8px 0; border-right: 1px solid #06171D;} - #djDebugToolbar #djDebugButton {color:red; font-weight:bold;} - #djDebug * {margin:0; padding:0; float:none; position:static; } - #djDebug .panelContent {display:none; position:absolute; margin:0; padding:5px; top:35px; width:auto; left:5px; right:5px; bottom:5px; background:white; color:black; border:1px solid black; z-index:1000000; overflow:auto;} - #djDebug .panelContent p {padding: 0 5px;} - #djDebug .panelContent p, #djDebug .panelContent table, #djDebug .panelContent ul, #djDebug .panelContent dl {margin:5px 0;} - #djDebug .close {float:right; font-weight:bold;} - #djDebug .panelContent dt, #djDebug .panelContent dd {display: block;} - #djDebug .panelContent dd {margin-left:10px;} - #djDebug th, #djDebug td {padding: 5px;} - #djDebug .row1 td {background:#fff;} - #djDebug .row2 td {background:#ddd;} + @import url({{ BASE_URL }}/__debug__/m/toolbar.css); </style> <div id="djDebug"> <div id="djDebugToolbar"> @@ -42,7 +14,7 @@ {% for panel in panels %} <li> {% if panel.has_content %} - <a href="{{ panel.url|default:"#" }}" onclick="djDebugToggle('{{ panel.dom_id }}')" title="{{ panel.title }}" class="{{ panel.dom_id }}">{{ panel.title }}</a> + <a href="{{ panel.url|default:"#" }}" title="{{ panel.title }}" class="{{ panel.dom_id }}">{{ panel.title }}</a> {% else %} {{ panel.title }} {% endif %} @@ -53,11 +25,10 @@ {% for panel in panels %} {% if panel.has_content %} <div id="{{ panel.dom_id }}" class="panelContent"> - <div class="title"> - <a href="" onclick="djDebugClose()" class="close">Close</a> - </div> + <a href="" class="close">Close</a> {{ panel.content|safe }} </div> {% endif %} {% endfor %} + <div id="djDebugWindow" class="panelContent"></div> </div> diff --git a/debug_toolbar/templates/debug_toolbar/panels/cache.html b/debug_toolbar/templates/debug_toolbar/panels/cache.html index 21ea173..3142783 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/cache.html +++ b/debug_toolbar/templates/debug_toolbar/panels/cache.html @@ -31,6 +31,7 @@ <td>{{ cache.get_many }}</td> </tr> </table> +{% if cache.calls %} <h3>Breakdown</h3> <table> <thead> @@ -51,4 +52,5 @@ </tr> {% endfor %} </tbody> -</table>
\ No newline at end of file +</table> +{% endif %} diff --git a/debug_toolbar/templates/debug_toolbar/panels/logger.html b/debug_toolbar/templates/debug_toolbar/panels/logger.html new file mode 100644 index 0000000..515c7fb --- /dev/null +++ b/debug_toolbar/templates/debug_toolbar/panels/logger.html @@ -0,0 +1,26 @@ +<h3>Log Messages</h3> +{% if records %} + <table> + <thead> + <tr> + <th>Level</th> + <th>Time</th> + <th>Message</th> + <th>Location</th> + </tr> + </thead> + <tbody> + {% for record in records %} + <tr class="{% cycle 'row1' 'row2' %}"> + <td>{{ record.level }}</td> + <td>{{ record.time|date:"h:i:s m/d/Y" }}</td> + <td>{{ record.message }}</td> + <td>{{ record.file }}:{{ record.line }}</td> + </tr> + {% endfor %} + </tbody> + </table> +{% else %} + <p>No messages logged.</p> +{% endif %} + diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql.html b/debug_toolbar/templates/debug_toolbar/panels/sql.html index 046be7f..e218f22 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/sql.html +++ b/debug_toolbar/templates/debug_toolbar/panels/sql.html @@ -3,6 +3,7 @@ <thead> <tr> <th>Time (ms)</th> + <th>Action</th> <th>Query</th> </tr> </thead> @@ -10,8 +11,13 @@ {% for query in queries %} <tr class="{% cycle 'row1' 'row2' %}"> <td>{{ query.time|floatformat:"4" }}</td> - <td><pre>{{ query.sql|escape }}</pre></td> + <td> + {% if query.params %} + <a class="remoteCall" href="/__debug__/sql_explain/?sql={{ query.raw_sql|urlencode }}¶ms={{ query.params|urlencode }}&time={{ query.time|floatformat:"4"|urlencode }}&hash={{ query.hash }}">EXPLAIN</a> + {% endif %} + </td> + <td class="syntax">{{ query.sql|safe }}</td> </tr> {% endfor %} </tbody> -</table>
\ No newline at end of file +</table> diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql_explain.html b/debug_toolbar/templates/debug_toolbar/panels/sql_explain.html new file mode 100644 index 0000000..d2fd567 --- /dev/null +++ b/debug_toolbar/templates/debug_toolbar/panels/sql_explain.html @@ -0,0 +1,26 @@ +<a class="back" href="">« Back</a> +<h3>SQL Explained</h3> +<dl> + <dt>Executed SQL</dt> + <dd><pre>{{ sql|safe }}</pre></dd> + <dt>Time</dt> + <dd>{{ time }} ms</dd> +</dl> +<table> + <thead> + <tr> + {% for h in headers %} + <th>{{ h|upper }}</th> + {% endfor %} + </tr> + </thead> + <tbody> + {% for row in result %} + <tr class="{% cycle 'row1' 'row2' %}"> + {% for column in row %} + <td>{{ column|escape }}</td> + {% endfor %} + </tr> + {% endfor %} + </tbody> +</table> diff --git a/debug_toolbar/templates/debug_toolbar/panels/templates.html b/debug_toolbar/templates/debug_toolbar/panels/templates.html index 58904be..a92657b 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/templates.html +++ b/debug_toolbar/templates/debug_toolbar/panels/templates.html @@ -1,4 +1,4 @@ -<h3>Template path(s):</h3> +<h3>Template path{{ template_dirs|length|pluralize }}:</h3> {% if template_dirs %} <ol> {% for template in template_dirs %} @@ -6,16 +6,34 @@ {% endfor %} </ol> {% else %} - None + <p>None</p> {% endif %} -<h3>Templates Used</h3> +<h3>Template{{ templates|length|pluralize }}</h3> {% if templates %} <dl> {% for template in templates %} - <dt><strong>{{ template.0 }}</strong></dt> - <dd><samp>{{ template.1 }}</samp></dd> + <dt><strong>{{ template.template.name|addslashes }}</strong></dt> + <dd><samp>{{ template.template.origin_name|addslashes }}</samp></dd> + <dd> + <div class="djTemplateShowContextDiv"><a class="djTemplateShowContext">Toggle Context</a></div> + <div class="djTemplateHideContextDiv" style="display:none;"><pre>{{ template.context }}</pre></div> + </dd> {% endfor %} </dl> {% else %} - None -{% endif %}
\ No newline at end of file + <p>None</p> +{% endif %} +<h3>Context processor{{ context_processors|length|pluralize }}</h3> +{% if context_processors %} +<dl> +{% for key, value in context_processors.iteritems %} + <dt><strong>{{ key|escape }}</strong></dt> + <dd> + <div class="djTemplateShowContextDiv"><a class="djTemplateShowContext">Toggle Context</a></div> + <div class="djTemplateHideContextDiv" style="display:none;"><pre>{{ value|escape }}</pre></div> + </dd> +{% endfor %} +</dl> +{% else %} + <p>None</p> +{% endif %} |
