Skip to content
This repository
Browse code

move 'explain', 'backtrace' etc. links to the left

- also switch to CSS nth-element instead of odd/
even classes.

- move backtrace info out of own <tr/> into a
div within the corresponding <td/> (that makes it
sort stable.
  • Loading branch information...
commit 64cce2c8389dc0961e599d0f06296ee583332568 1 parent 296ccb9
Constantin Hofstetter consti authored
10 lib/rack/bug/public/__rack_bug__/bug.css
@@ -170,7 +170,12 @@
170 170 color: #000;
171 171 vertical-align: top;
172 172 }
173   -#rack_bug .panel_content table tr.odd td {
  173 +
  174 +#rack_bug .panel_content table tr:nth-child(even) td {
  175 + background: #fff;
  176 +}
  177 +
  178 +#rack_bug .panel_content table tr:nth-child(odd) td {
174 179 background: #eee;
175 180 }
176 181
@@ -187,8 +192,7 @@
187 192 margin-left: 10px;
188 193 }
189 194
190   -#rack_bug .panel_content table tr.odd td.rack_bug_spinner,
191   -#rack_bug .panel_content table tr.even td.rack_bug_spinner,
  195 +#rack_bug .panel_content table tr td.rack_bug_spinner,
192 196 #rack_bug .panel_content table td.rack_bug_spinner,
193 197 #rack_bug .rack_bug_spinner {
194 198 background-image: url(/__rack_bug__/spinner.gif);
2  lib/rack/bug/public/__rack_bug__/bug.js
@@ -30,7 +30,7 @@ jQuery(function($) {
30 30 return false;
31 31 });
32 32 $('#rack_bug a.reveal_backtrace').click(function() {
33   - $(this).parents("tr").next().toggle();
  33 + $(this).parents('tr').find('ul.backtrace').toggle();
34 34 return false;
35 35 });
36 36 $('#rack_bug a.rack_bug_close').click(function() {
2  lib/rack/bug/views/panels/cache.html.erb
@@ -57,7 +57,7 @@
57 57 <tbody>
58 58 <% i = 1 %>
59 59 <% stats.queries.each do |query| %>
60   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  60 + <tr>
61 61 <td><%= query.display_time %></td>
62 62 <td><%= query.method %></td>
63 63 <td><%= query.display_keys %></td>
2  lib/rack/bug/views/panels/execute_sql.html.erb
@@ -27,7 +27,7 @@
27 27 <tbody>
28 28 <% i = 1 %>
29 29 <% result.each do |row| %>
30   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  30 + <tr>
31 31 <% row.each do |value| %>
32 32 <td><%= value %></td>
33 33 <% end %>
2  lib/rack/bug/views/panels/explain_sql.html.erb
@@ -27,7 +27,7 @@
27 27 <tbody>
28 28 <% i = 1 %>
29 29 <% result.each do |row| %>
30   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  30 + <tr>
31 31 <% row.each do |value| %>
32 32 <td><%= value %></td>
33 33 <% end %>
2  lib/rack/bug/views/panels/log.html.erb
@@ -10,7 +10,7 @@
10 10 <tbody>
11 11 <% i = 1 %>
12 12 <% logs.each do |entry| %>
13   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  13 + <tr>
14 14 <td><%= entry.level %></td>
15 15 <td><%= entry.time %>ms</td>
16 16 <td><%= entry.cleaned_message %></td>
2  lib/rack/bug/views/panels/mongo.html.erb
@@ -21,7 +21,7 @@
21 21 <tbody>
22 22 <% i = 1 %>
23 23 <% stats.queries.each do |query| %>
24   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  24 + <tr>
25 25 <td><%= query.display_time %></td>
26 26 <td><%= query.command %></td>
27 27 </tr>
2  lib/rack/bug/views/panels/profile_sql.html.erb
@@ -27,7 +27,7 @@
27 27 <tbody>
28 28 <% i = 1 %>
29 29 <% result.each do |row| %>
30   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  30 + <tr>
31 31 <% row.each do |value| %>
32 32 <td><%= value %></td>
33 33 <% end %>
2  lib/rack/bug/views/panels/rails_info.html.erb
@@ -9,7 +9,7 @@
9 9 <tbody>
10 10 <% i = 1 %>
11 11 <% Rails::Info.properties.each do |key, val| %>
12   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  12 + <tr>
13 13 <td><%=h key %></td>
14 14 <td class="code"><div><%=h val %></div></td>
15 15 </tr>
2  lib/rack/bug/views/panels/redis.html.erb
@@ -22,7 +22,7 @@
22 22 <tbody>
23 23 <% i = 1 %>
24 24 <% stats.queries.each do |query| %>
25   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  25 + <tr>
26 26 <td><%= query.display_time %></td>
27 27 <td><%= query.command %></td>
28 28 <td><%= "<a href='#' class='reveal_backtrace'>Show Backtrace</a>" if query.has_backtrace? %></td>
2  lib/rack/bug/views/panels/request_variables.html.erb
@@ -12,7 +12,7 @@
12 12 <tbody>
13 13 <% i = 1 %>
14 14 <% sections[header].each do |key, val| %>
15   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  15 + <tr>
16 16 <td><%=h key %></td>
17 17 <td class="code"><div>
18 18 <% if val.is_a?(Hash) %>
2  lib/rack/bug/views/panels/sphinx.html.erb
@@ -21,7 +21,7 @@
21 21 <tbody>
22 22 <% i = 1 %>
23 23 <% stats.queries.each do |query| %>
24   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  24 + <tr>
25 25 <td><%= query.display_time %></td>
26 26 <td><%= query.command %></td>
27 27 </tr>
36 lib/rack/bug/views/panels/sql.html.erb
@@ -11,26 +11,24 @@
11 11 <tbody>
12 12 <% i = 1 %>
13 13 <% queries.each do |query| %>
14   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  14 + <tr>
15 15 <td><%= query.human_time %></td>
16   - <td class="syntax"><%= query.sql %></td>
17   - <td>
18   - <% if query.has_backtrace? %>
19   - <a href="#" class="reveal_backtrace">Show Backtrace</a>
20   - <% end %>
21   - </td>
22   - <td>
23   - <% if query.inspectable? %>
24   - <a href="/__rack_bug__/execute_sql?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">SELECT</a> |
25   - <a href="/__rack_bug__/explain_sql?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">EXPLAIN</a> |
26   - <a href="/__rack_bug__/profile_sql?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">Profile</a>
27   - <% end %>
28   - </td>
29   - </tr>
30   - <tr style="display:none">
31   - <td></td>
32   - <td colspan="3">
33   - <ul>
  16 + <td class="syntax">
  17 + <%= query.sql %>
  18 + <div class='opts'>
  19 + <% if query.has_backtrace? %>
  20 + <a href="#" class="reveal_backtrace">Show Backtrace</a>
  21 + <% end %>
  22 + <% if query.inspectable? && query.has_backtrace? %>
  23 + |
  24 + <% end %>
  25 + <% if query.inspectable? %>
  26 + <a href="/__rack_bug__/execute_sql?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">SELECT</a> |
  27 + <a href="/__rack_bug__/explain_sql?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">EXPLAIN</a> |
  28 + <a href="/__rack_bug__/profile_sql?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">Profile</a>
  29 + <% end %>
  30 + </div>
  31 + <ul style="display:none" class='backtrace'>
34 32 <% query.filtered_backtrace.each do |line| %>
35 33 <li><%=h line %></li>
36 34 <% end %>
2  lib/rack/bug/views/panels/timer.html.erb
@@ -9,7 +9,7 @@
9 9 <tbody>
10 10 <% i = 1 %>
11 11 <% measurements.each do |key, val| %>
12   - <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
  12 + <tr>
13 13 <td><%=h key %></td>
14 14 <td><%=h val %></td>
15 15 </tr>

0 comments on commit 64cce2c

Please sign in to comment.
Something went wrong with that request. Please try again.