Sha256: 55486ef3efd7b56e3be03cf52f201de70b0645fb57dca82e0ba0c34b508ba049
Contents?: true
Size: 949 Bytes
Versions: 2
Compression:
Stored size: 949 Bytes
Contents
module Footnotes module Notes class ViewNote < AbstractNote thread_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" % 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 = template.try(:[], :file) 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/view_note.rb |
rails-footnotes-7.0.1 | lib/rails-footnotes/notes/view_note.rb |