Class: Footnotes::Notes::PartialsNote

Inherits:
LogNote show all
Defined in:
lib/rails-footnotes/notes/partials_note.rb

Instance Method Summary collapse

Methods inherited from AbstractNote

close!, #has_fieldset?, included?, #javascript, #legend, #link, #onclick, #row, start!, #stylesheet, title, #to_sym, to_sym, #valid?

Constructor Details

#initialize(controller) ⇒ PartialsNote

Returns a new instance of PartialsNote.



6
7
8
9
10
# File 'lib/rails-footnotes/notes/partials_note.rb', line 6

def initialize(controller)
  @controller = controller
  @template = controller.instance_variable_get('@template')
  @partials = get_partials
end

Instance Method Details

#contentObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rails-footnotes/notes/partials_note.rb', line 12

def content
  result = '<ul>'
    @partials.collect.each do |partial|
      full_filename = File.join(File.expand_path(RAILS_ROOT), 'app', 'views', partial.first.to_s)
      result += "<li><a href='#{Footnotes::Filter.prefix}#{full_filename}'>"
      result += "#{partial.last}</a></li>"
    end
  result += '</ul>'
 
 result
end

#titleObject



24
25
26
# File 'lib/rails-footnotes/notes/partials_note.rb', line 24

def title
  "Partials (#{@partials.length})"        
end