Skip to content

Commit

Permalink
Change queries notes so they use tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Intrepidd committed May 13, 2014
1 parent c04f521 commit d66880a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/rails-footnotes/notes/queries_note.rb
Expand Up @@ -33,18 +33,25 @@ def title
end

def content
html = ''
html = '<table>'
self.events.each_with_index do |event, index|
sql_links = []
sql_links << "<a href=\"javascript:Footnotes.toggle('qtrace_#{index}')\" style=\"color:#00A;\">trace</a>"

html << <<-HTML
<b id="qtitle_#{index}">#{escape(event.type.to_s.upcase)}</b> (#{sql_links.join(' | ')})<br />
<span id="sql_#{index}">#{print_query(event.payload[:sql])}</span><br />
#{print_name_and_time(event.payload[:name], event.duration / 1000.0)}&nbsp;
<p id="qtrace_#{index}" style="display:none;">#{parse_trace(event.trace)}</p><br />
<tr>
<td>
<b id="qtitle_#{index}">#{escape(event.type.to_s.upcase)}</b> (#{sql_links.join(' | ')})
<p id="qtrace_#{index}" style="display:none;">#{parse_trace(event.trace)}</p><br />
</td>
<td>
<span id="sql_#{index}">#{print_query(event.payload[:sql])}</span>
</td>
<td>#{print_name_and_time(event.payload[:name], event.duration / 1000.0)}</td>
</tr>
HTML
end
html << '</table>'
return html
end

Expand Down

0 comments on commit d66880a

Please sign in to comment.