Sha256: 4700ae420e8aa40416e053e71bc0eb55a0e18b7e5ffbba94808d16221e84c3df
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
module Footnotes module Notes class PartialsNote < AbstractNote thread_cattr_accessor :partials def self.start!(controller) self.partials = [] @subscriber ||= ActiveSupport::Notifications.subscribe('render_partial.action_view') do |*args| event = ActiveSupport::Notifications::Event.new(*args) self.partials << {:file => event.payload[:identifier], :duration => event.duration} end end def initialize(controller) @controller = controller end def row :edit end def title "Partials (#{partials.size})" end def content rows = self.class.partials.map do |partial| href = Footnotes::Filter.prefix(partial[:file],1,1) shortened_name = partial[:file].gsub(File.join(Rails.root,"app/views/"),"") [%{<a href="#{href}">#{shortened_name}</a>},"#{partial[:duration]}ms"] end mount_table(rows.unshift(%w(Partial Time)), :summary => "Partials for #{title}") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails-footnotes-7.1.0 | lib/rails-footnotes/notes/partials_note.rb |
rails-footnotes-7.0.1 | lib/rails-footnotes/notes/partials_note.rb |