Class: Footnotes::Notes::PartialsNote

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

Instance Method Summary collapse

Methods inherited from LogNote

log, #log

Methods included from LogNote::LoggingExtensions

#add

Methods inherited from AbstractNote

close!, #escape, #has_fieldset?, #hash_to_xml_attributes, included?, #javascript, #legend, #link, #mount_table, #mount_table_for_hash, #onclick, #prefix?, start!, #stylesheet, title, #to_sym, to_sym, #valid?

Constructor Details

#initialize(controller) ⇒ PartialsNote

Returns a new instance of PartialsNote.



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

def initialize(controller)
  super
  @controller = controller
end

Instance Method Details

#contentObject



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

def content
  rows = partials.map do |filename|
    href = Footnotes::Filter.prefix(filename,1,1)
    shortened_name=filename.gsub(File.join(Rails.root,"app/views/"),"")
    [%{<a href="#{href}">#{shortened_name}</a>},"#{@partial_times[filename].sum}ms",@partial_counts[filename]]
  end
  mount_table(rows.unshift(%w(Partial Time Count)), :summary => "Partials for #{title}")
end

#rowObject



10
11
12
# File 'lib/rails-footnotes/notes/partials_note.rb', line 10

def row
  :edit
end

#titleObject



13
14
15
# File 'lib/rails-footnotes/notes/partials_note.rb', line 13

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