Module: Footnotes::Components

Defined in:
lib/rails-footnotes/notes/components_note.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/rails-footnotes/notes/components_note.rb', line 44

def self.included(base)
  base.class_eval do
    alias_method_chain :add_footnotes!, :component
    Footnotes::Filter.notes.delete(:components)
    @@component_notes = [ :controller, :view, :params ]
  end
end

Instance Method Details

#add_footnotes_with_component!Object



52
53
54
55
56
57
58
59
60
# File 'lib/rails-footnotes/notes/components_note.rb', line 52

def add_footnotes_with_component!
  if component_request?
    initialize_component_notes!
    Footnotes::Filter.notes.unshift(*@notes)
  else
    add_footnotes_without_component!
    Footnotes::Filter.notes.delete_if {|note| note.class.to_s =~ /(ComponentNote)$/}
  end
end