Class: Footnotes::Notes::ViewNote
Class Method Summary
collapse
Instance Method Summary
collapse
close!, #escape, #has_fieldset?, #hash_to_xml_attributes, included?, #javascript, #legend, #mount_table, #mount_table_for_hash, #onclick, #prefix?, #stylesheet, title, to_sym, #to_sym
Constructor Details
#initialize(controller) ⇒ ViewNote
Returns a new instance of ViewNote.
13
14
15
|
# File 'lib/rails-footnotes/notes/view_note.rb', line 13
def initialize(controller)
@controller = controller
end
|
Class Method Details
.start!(controller) ⇒ Object
6
7
8
9
10
11
|
# File 'lib/rails-footnotes/notes/view_note.rb', line 6
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
|
Instance Method Details
#link ⇒ Object
25
26
27
|
# File 'lib/rails-footnotes/notes/view_note.rb', line 25
def link
escape(Footnotes::Filter.prefix(filename, 1, 1))
end
|
#row ⇒ Object
17
18
19
|
# File 'lib/rails-footnotes/notes/view_note.rb', line 17
def row
:edit
end
|
#title ⇒ Object
21
22
23
|
# File 'lib/rails-footnotes/notes/view_note.rb', line 21
def title
"View (#{"%.3f" % self.template[:duration]}ms)"
end
|
#valid? ⇒ Boolean
29
30
31
|
# File 'lib/rails-footnotes/notes/view_note.rb', line 29
def valid?
prefix? && filename && File.exists?(filename)
end
|