Skip to content

Commit 809945d

Browse files
author
Tomasz Buchert
committed
Issue django-commons#163: SQL expand does show query fields now. So does clicking on bullets.
1 parent 64edae3 commit 809945d

File tree

5 files changed

+22
-16
lines changed

5 files changed

+22
-16
lines changed

debug_toolbar/media/debug_toolbar/css/toolbar.css

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -369,19 +369,17 @@
369369
position:relative;
370370
}
371371

372-
#djDebug .djDebugCollapse {
373-
display: inline-block;
374-
background: #ddd;
375-
background: url(data:image/gif;base64,R0lGODlhBgAKAJEDAJGRkdra2qysrP///yH5BAEAAAMALAAAAAAGAAoAAAIPnI+JIRImABBQ0sGc2qoAADs=) 0 3px repeat-x;
376-
width: 18px;
377-
text-indent: -10000em;
372+
#djDebug .djDebugCollapsed {
373+
display: none;
374+
text-decoration: none;
375+
color: #333;
378376
}
379-
#djDebug .djSelected .djDebugCollapse {
380-
background: inherit;
381-
text-indent: 0;
382-
width: auto;
383-
display: inline;
377+
378+
#djDebug .djDebugUncollapsed {
379+
color: #333;
380+
text-decoration: none;
384381
}
382+
385383
#djDebug .djUnselected {
386384
display: none;
387385
}

debug_toolbar/media/debug_toolbar/css/toolbar.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

debug_toolbar/media/debug_toolbar/js/toolbar.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ window.djdt = (function(window, document, jQuery) {
5151
djdt.toggle_content($(this).parent().next());
5252
return false;
5353
});
54+
$('#djDebug a.djDebugToggle').click(function(e) {
55+
e.preventDefault();
56+
$(this).parent().find('.djDebugCollapsed').toggle();
57+
$(this).parent().find('.djDebugUncollapsed').toggle()
58+
});
5459
$('#djDebug a.djToggleSwitch').click(function(e) {
5560
e.preventDefault();
5661
var btn = $(this);
@@ -60,6 +65,8 @@ window.djdt = (function(window, document, jQuery) {
6065
return;
6166
}
6267

68+
btn.parents('.djDebugPanelContent').find('#sqlMain_' + id).find('.djDebugCollapsed').toggle(open_me);
69+
btn.parents('.djDebugPanelContent').find('#sqlMain_' + id).find('.djDebugUncollapsed').toggle(!open_me);
6370
$(this).parents('.djDebugPanelContent').find('.djToggleDetails_' + id).each(function(){
6471
var $this = $(this);
6572
if (open_me) {

debug_toolbar/media/debug_toolbar/js/toolbar.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

debug_toolbar/panels/sql.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ def process(self, stack, stream):
223223
yield sqlparse.tokens.Text, '</strong>'
224224

225225
def swap_fields(sql):
226-
return re.sub('SELECT</strong> (.*) <strong>FROM', 'SELECT</strong> <span class="djDebugCollapse">\g<1></span> <strong>FROM', sql)
226+
return re.sub('SELECT</strong> (.*) <strong>FROM', 'SELECT</strong> <a class="djDebugUncollapsed djDebugToggle" href="#">&bull;&bull;&bull;</a> ' +
227+
'<a class="djDebugCollapsed djDebugToggle" href="#">\g<1></a> <strong>FROM', sql)
227228

228229
def reformat_sql(sql):
229230
stack = sqlparse.engine.FilterStack()

0 commit comments

Comments
 (0)