Sha256: 574ee24284a7e17cf1ecb1fb5f2cb15e37f1cf39e57ad883e84721261aaf8c17
Contents?: true
Size: 958 Bytes
Versions: 2
Compression:
Stored size: 958 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.exists?(filename) end protected def filename return @filename if defined?(@filename) @filename = self.class.template.try(:[], :file) end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
rails-footnotes-5.0.0 | lib/rails-footnotes/notes/view_note.rb |
rails6-footnotes-5.0.2 | lib/rails-footnotes/notes/view_note.rb |