Sha256: 64329e5886acfb84ba758215d2d783df85131a38899211271e7a47fe74f38571
Contents?: true
Size: 957 Bytes
Versions: 1
Compression:
Stored size: 957 Bytes
Contents
module Footnotes module Notes class ViewNote < AbstractNote cattr_accessor :template def self.start!(controller) @subscriber ||= ActiveSupport::Notifications.subscribe('render_template.action_view') do |*args| event = ActiveSupport::Notifications::Event.new *args self.template = {:file => event.payload[:identifier], :duration => event.duration} end end def initialize(controller) @controller = controller end def row :edit end def title "View (#{"%.3f" % self.template[:duration]}ms)" end def link escape(Footnotes::Filter.prefix(filename, 1, 1)) end def valid? prefix? && filename && File.exist?(filename) end protected def filename return @filename if defined?(@filename) @filename = self.class.template.try(:[], :file) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails-footnotes-7.0.0 | lib/rails-footnotes/notes/view_note.rb |