<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/notes/components_note.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -3,16 +3,31 @@ module Footnotes
     @@no_style = false
     @@multiple_notes = false
     # Edit notes
-    @@notes = [ :controller, :view, :layout, :stylesheets, :javascripts ]
+    @@notes = [ :components, :controller, :view, :layout, :stylesheets, :javascripts ]
     # Show notes
-    @@notes += [:session, :cookies, :params, :filters, :routes, :queries, :log, :general]
+    @@notes += [ :session, :cookies, :params, :filters, :routes, :queries, :log, :general ]
 
     cattr_accessor :no_style, :notes, :prefix, :multiple_notes
 
-    def self.filter(controller)
-      filter = Footnotes::Filter.new(controller)
-      filter.add_footnotes!
-      filter.reset!
+    class &lt;&lt; self
+      def before(controller)
+        Footnotes::Filter.start!
+      end
+
+      def after(controller)
+        filter = Footnotes::Filter.new(controller)
+        filter.add_footnotes!
+        filter.close!
+      end
+
+      def start!
+        @@notes.flatten.each do |note|
+          klass = eval(&quot;Footnotes::Notes::#{note.to_s.camelize}Note&quot;) if note.is_a?(Symbol) || note.is_a?(String)
+          klass.start! if klass.respond_to?(:start!)
+        end
+      rescue Exception =&gt; e
+        log_error(&quot;Footnotes Exception&quot;, e)
+      end
     end
 
     def initialize(controller)
@@ -29,13 +44,13 @@ module Footnotes
       log_error(&quot;Footnotes Exception&quot;, e)
     end
 
-    def reset!
-      @notes.map(&amp;:reset!)
+    def close!
+      @notes.map{|note| note.class.close!}
     end
 
     protected
     def valid?
-      performed_render? &amp;&amp; first_render? &amp;&amp; valid_format? &amp;&amp; valid_content_type? &amp;&amp; @body.is_a?(String) &amp;&amp; !xhr?
+      performed_render? &amp;&amp; first_render? &amp;&amp; valid_format? &amp;&amp; valid_content_type? &amp;&amp; @body.is_a?(String) &amp;&amp; !component_request? &amp;&amp; !xhr?
     end
 
     def add_footnotes_without_validation!
@@ -47,8 +62,8 @@ module Footnotes
     def initialize_notes!
       @@notes.flatten.each do |note|
         begin
-          instance_note = eval(&quot;Footnotes::Notes::#{note.to_s.camelize}Note&quot;).new(@controller)
-          @notes &lt;&lt; instance_note if instance_note.valid?
+          note = eval(&quot;Footnotes::Notes::#{note.to_s.camelize}Note&quot;).new(@controller) if note.is_a?(Symbol) || note.is_a?(String)
+          @notes &lt;&lt; note if note.respond_to?(:valid?) &amp;&amp; note.valid?
         rescue Exception =&gt; e
           # Discard note if it has a problem
           log_error(&quot;Footnotes #{note.to_s.camelize}Note Exception&quot;, e)
@@ -74,6 +89,10 @@ module Footnotes
       (c.nil? || c =~ /html/)
     end
 
+    def component_request?
+      @controller.instance_variable_get('@parent_controller')
+    end
+
     def xhr?
       @controller.request.xhr?
     end
@@ -144,7 +163,7 @@ module Footnotes
       html = ''
       order.uniq!
       order.each do |row|
-        html &lt;&lt; &quot;#{row.to_s.capitalize}: #{links[row].join(&quot; | \n&quot;)}&lt;br /&gt;&quot;
+        html &lt;&lt; &quot;#{row.is_a?(String) ? row : row.to_s.camelize}: #{links[row].join(&quot; | \n&quot;)}&lt;br /&gt;&quot;
       end
       html
     end</diff>
      <filename>lib/footnotes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,5 +9,6 @@ end
 # application. Then you can cherrypick in which actions it will appear.
 #
 class ActionController::Base
+  prepend_before_filter Footnotes::Filter
   after_filter Footnotes::Filter
 end
\ No newline at end of file</diff>
      <filename>lib/initializer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -16,8 +16,20 @@ module Footnotes
         def included?
           Footnotes::Filter.notes.include?(self.to_sym)
         end
+
+        # Action to be called to start the Note.
+        # This is applied as a before_filter.
+        #
+        def start!
+        end
+
+        # Action to be called after the Note was used.
+        # This is applied as an after_filter.
+        #
+        def close!
+        end
       end
-      
+
       # Initialize notes.
       # Always receives a controller.
       #
@@ -76,11 +88,6 @@ module Footnotes
       def javascript
       end
 
-      # Action to be called after the Note was used.
-      #
-      def reset!
-      end
-
       # Specifies when should create a note for it.
       # By default, if title exists, it's valid.
       #</diff>
      <filename>lib/notes/abstract_note.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,10 @@ module Footnotes
       @@sql = []
       cattr_accessor :sql
 
+      def self.start!
+        @@sql = []
+      end
+
       def self.to_sym
         :queries
       end
@@ -19,7 +23,7 @@ module Footnotes
       end
 
       def stylesheet
-        '#queries_debug_info thead, #queries_debug_info tbody {text-align: center; color:#FF0000;}'
+        '.queries_debug_table thead, .queries_debug_table tbody {text-align: center; color:#FF0000;}'
       end
 
       def content
@@ -28,14 +32,10 @@ module Footnotes
           html &lt;&lt; &quot;&lt;b&gt;#{item[0].to_s.upcase}&lt;/b&gt;\n&quot;
           html &lt;&lt; &quot;#{item[1] || 'SQL'} (#{sprintf('%f',item[2])}s)\n&quot;
           html &lt;&lt; &quot;#{item[3].gsub(/(\s)+/,' ').gsub('`','')}\n&quot;
-          html &lt;&lt; (item[4] ? mount_table(item[4]) : &quot;\n&quot;)
+          html &lt;&lt; (item[4] ? mount_table(item[4], :class =&gt; 'queries_debug_table') : &quot;\n&quot;)
         end
         &quot;&lt;pre&gt;#{html}&lt;/pre&gt;&quot;
       end
-
-      def reset!
-        @@sql = []
-      end
     end
   end
 </diff>
      <filename>lib/notes/queries_note.rb</filename>
    </modified>
    <modified>
      <diff>@@ -98,8 +98,8 @@ class FootnotesTest &lt; Test::Unit::TestCase
 
   def test_notes_are_reset
     footnotes_perform!
-    @footnotes.instance_variable_get('@notes').first.expects(:reset!)
-    @footnotes.send(:reset!)
+    @footnotes.instance_variable_get('@notes').first.class.expects(:close!)
+    @footnotes.send(:close!)
   end
 
   def test_links_helper</diff>
      <filename>test/footnotes_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,11 @@ class AbstractNoteTest &lt; Test::Unit::TestCase
     Footnotes::Filter.notes = [:abstract]
   end
 
+  def test_respond_to_start_and_close
+    assert_respond_to Footnotes::Notes::AbstractNote, :start!
+    assert_respond_to Footnotes::Notes::AbstractNote, :close!
+  end
+  
   def test_respond_to_sym
     assert_equal :abstract, Footnotes::Notes::AbstractNote.to_sym
     assert_equal :abstract, @note.to_sym
@@ -75,19 +80,19 @@ class AbstractNoteTest &lt; Test::Unit::TestCase
   
   def test_footnotes_mount_table
     assert_equal '', @note.send(:mount_table,[])
-    assert_equal '', @note.send(:mount_table,[['h1','h2','h3']])
+    assert_equal '', @note.send(:mount_table,[['h1','h2','h3']], :class =&gt; 'table')
 
     tab = &lt;&lt;-TABLE
-          &lt;table&gt;
+          &lt;table class=&quot;table&quot;&gt;
             &lt;thead&gt;&lt;tr&gt;&lt;th&gt;H1&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
             &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;r1c1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;
           &lt;/table&gt;
           TABLE
 
-    assert_equal tab, @note.send(:mount_table,[['h1'],['r1c1']])
+    assert_equal tab, @note.send(:mount_table,[['h1'],['r1c1']], :class =&gt; 'table')
 
     tab = &lt;&lt;-TABLE
-          &lt;table&gt;
+          &lt;table &gt;
             &lt;thead&gt;&lt;tr&gt;&lt;th&gt;H1&lt;/th&gt;&lt;th&gt;H2&lt;/th&gt;&lt;th&gt;H3&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
             &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;r1c1&lt;/td&gt;&lt;td&gt;r1c2&lt;/td&gt;&lt;td&gt;r1c3&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;
           &lt;/table&gt;
@@ -96,7 +101,7 @@ class AbstractNoteTest &lt; Test::Unit::TestCase
     assert_equal tab, @note.send(:mount_table,[['h1','h2','h3'],['r1c1','r1c2','r1c3']])
 
     tab = &lt;&lt;-TABLE
-          &lt;table&gt;
+          &lt;table &gt;
             &lt;thead&gt;&lt;tr&gt;&lt;th&gt;H1&lt;/th&gt;&lt;th&gt;H2&lt;/th&gt;&lt;th&gt;H3&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
             &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;r1c1&lt;/td&gt;&lt;td&gt;r1c2&lt;/td&gt;&lt;td&gt;r1c3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;r2c1&lt;/td&gt;&lt;td&gt;r2c2&lt;/td&gt;&lt;td&gt;r2c3&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;
           &lt;/table&gt;</diff>
      <filename>test/notes/abstract_note_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>24042f4a2cb9b3d6e55a4ff2a0bf8e9d65cfedfd</id>
    </parent>
  </parents>
  <author>
    <name>josevalim</name>
    <email>jose.valim@gmail.com</email>
  </author>
  <url>http://github.com/mhartl/rails-footnotes/commit/ab4edda689c8b75ad3ce1f8b1f6f58211c168a11</url>
  <id>ab4edda689c8b75ad3ce1f8b1f6f58211c168a11</id>
  <committed-date>2008-06-11T14:51:36-07:00</committed-date>
  <authored-date>2008-06-11T14:51:36-07:00</authored-date>
  <message>Added ComponentsNote (it shows renderized components links)</message>
  <tree>2fa3908826e3f04c1528418f70ccf693bc21f6d8</tree>
  <committer>
    <name>josevalim</name>
    <email>jose.valim@gmail.com</email>
  </committer>
</commit>
