Skip to content

Commit 42ec148

Browse files
committed
Simplify CSS classes and rules on th/td elements
These CSS classes don't style th element, but td elements. So remove from th elements for slightly smaller HTML. The rule: #djDebug .djdt-panelContent thead th { white-space: nowrap; } duplicates the rule on line 350 with the same selector. A it is redundant, remove it. djdt-query had no CSS and no JavaScript associated with it. As it has no effect, remove it. djdt-timeline only adds a width. There already exist a series of generic classes to set widths "djdt-width-*', so use this pattern instead of a new one-off CSS class.
1 parent 677a3e2 commit 42ec148

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

debug_toolbar/static/debug_toolbar/css/toolbar.css

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,6 @@
514514
color: #333;
515515
} /* Comment.Preproc */
516516

517-
#djDebug .djdt-timeline {
518-
width: 30%;
519-
}
520-
521517
#djDebug svg.djDebugLineChart {
522518
width: 100%;
523519
height: 1.5em;
@@ -534,9 +530,6 @@
534530
stroke: #94b24d;
535531
}
536532

537-
#djDebug .djdt-panelContent thead th {
538-
white-space: nowrap;
539-
}
540533
#djDebug .djDebugRowWarning .djdt-time {
541534
color: red;
542535
}
@@ -602,6 +595,9 @@
602595
#djDebug .djdt-width-20 {
603596
width: 20%;
604597
}
598+
#djDebug .djdt-width-30 {
599+
width: 30%;
600+
}
605601
#djDebug .djdt-width-60 {
606602
width: 60%;
607603
}

debug_toolbar/static/debug_toolbar/js/timer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function addRow(stat, endStat) {
2020
"<td>" +
2121
stat.replace("Start", "") +
2222
"</td>" +
23-
'<td class="djdt-timeline"><svg class="djDebugLineChart" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 5" preserveAspectRatio="none"><rect y="0" height="5" fill="#ccc" /></svg></td>' +
23+
'<td><svg class="djDebugLineChart" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 5" preserveAspectRatio="none"><rect y="0" height="5" fill="#ccc" /></svg></td>' +
2424
"<td>" +
2525
(performance.timing[stat] - timingOffset) +
2626
" (+" +
@@ -36,7 +36,7 @@ function addRow(stat, endStat) {
3636
"<td>" +
3737
stat +
3838
"</td>" +
39-
'<td class="djdt-timeline"><svg class="djDebugLineChart" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 5" preserveAspectRatio="none"><rect y="0" height="5" fill="#ccc" /></svg></td>' +
39+
'<td><svg class="djDebugLineChart" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 5" preserveAspectRatio="none"><rect y="0" height="5" fill="#ccc" /></svg></td>' +
4040
"<td>" +
4141
(performance.timing[stat] - timingOffset) +
4242
"</td>";

debug_toolbar/templates/debug_toolbar/panels/history.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<th>{% trans "Method" %}</th>
1111
<th>{% trans "Path" %}</th>
1212
<th>{% trans "Request Variables" %}</th>
13-
<th class="djdt-actions">{% trans "Action" %}</th>
13+
<th>{% trans "Action" %}</th>
1414
</tr>
1515
</thead>
1616
<tbody id="djdtHistoryRequests">

debug_toolbar/templates/debug_toolbar/panels/sql.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,21 @@
2020

2121
{% if queries %}
2222
<table>
23+
<colgroup>
24+
<col>
25+
<col>
26+
<col>
27+
<col class="djdt-width-30">
28+
<col>
29+
<col>
30+
</colgroup>
2331
<thead>
2432
<tr>
2533
<th></th>
26-
<th class="djdt-query" colspan="2">{% trans "Query" %}</th>
27-
<th class="djdt-timeline">{% trans "Timeline" %}</th>
28-
<th class="djdt-time">{% trans "Time (ms)" %}</th>
29-
<th class="djdt-actions">{% trans "Action" %}</th>
34+
<th colspan="2">{% trans "Query" %}</th>
35+
<th>{% trans "Timeline" %}</th>
36+
<th>{% trans "Time (ms)" %}</th>
37+
<th>{% trans "Action" %}</th>
3038
</tr>
3139
</thead>
3240
<tbody>
@@ -36,7 +44,7 @@
3644
<td class="djdt-toggle">
3745
<button type="button" class="djToggleSwitch" data-toggle-name="sqlMain" data-toggle-id="{{ forloop.counter }}">+</button>
3846
</td>
39-
<td class="djdt-query">
47+
<td>
4048
<div class="djDebugSql">{{ query.sql|safe }}</div>
4149
{% if query.similar_count %}
4250
<strong>
@@ -51,7 +59,7 @@
5159
</strong>
5260
{% endif %}
5361
</td>
54-
<td class="djdt-timeline">
62+
<td>
5563
<svg class="djDebugLineChart{% if query.is_slow %} djDebugLineChartWarning{% endif %}{% if query.in_trans %} djDebugLineChartInTransaction{% endif %}" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 5" preserveAspectRatio="none" aria-label="{{ query.width_ratio }}%">
5664
<rect x="{{ query.start_offset|unlocalize }}" y="0" height="5" width="{{ query.width_ratio|unlocalize }}" fill="{{ query.trace_color }}" />
5765
{% if query.starts_trans %}

debug_toolbar/templates/debug_toolbar/panels/timer.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ <h4>{% trans "Browser timing" %}</h4>
3333
<thead>
3434
<tr>
3535
<th>{% trans "Timing attribute" %}</th>
36-
<th class="djdt-timeline">{% trans "Timeline" %}</th>
37-
<th class="djdt-time">{% trans "Milliseconds since navigation start (+length)" %}</th>
36+
<th>{% trans "Timeline" %}</th>
37+
<th>{% trans "Milliseconds since navigation start (+length)" %}</th>
3838
</tr>
3939
</thead>
4040
<tbody id="djDebugBrowserTimingTableBody">

0 commit comments

Comments
 (0)