Sha256: fbc63eb06d3ece73e0b5cc27c91272b1f78b106caf9ff7d9ab8d854a749c256c
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require "#{File.dirname(__FILE__)}/abstract_note" require "#{File.dirname(__FILE__)}/../view_subscriber" module Footnotes module Notes class RenderNote < AbstractNote def initialize(controller) super @controller = controller @page = Footnotes.view_subscriber.page end def title "<span style=\"background-color:#{color(@page.duration)}\">Render (#{"%.3f" % @page.duration}ms)</span>" end def content html = '' if @page view = Footnotes.view_subscriber.view_name layout = Footnotes.view_subscriber.layout_name partial_time = Footnotes.view_subscriber.partial_time rows = [["View", "Layout", "View Render", "Partial Render", "Total Render"], [escape(view), escape(layout), "#{'%.3f' % (@page.duration - partial_time)}ms", "<a href=\"#\" onclick=\"Footnotes.hideAllAndToggle('partials_debug_info');return false;\">#{'%.3f' % partial_time}ms</a>", "#{'%.3f' % @page.duration}ms"]] mount_table(rows) end end def color(value) value > 500.0 ? "#f00" : "#aaa" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails3-footnotes-4.0.0.pre.5 | lib/rails-footnotes/notes/render_note.rb |