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
"Rendered (#{"%.3f" % @page.duration}ms)"
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",
"#{'%.3f' % partial_time}ms",
"#{'%.3f' % @page.duration}ms"]]
mount_table(rows)
end
end
def color(value)
value > 500.0 ? "#f00" : "#aaa"
end
end
end
end