lib/rails-footnotes/notes/layout_note.rb in rails3-footnotes-4.0.0.pre.3 vs lib/rails-footnotes/notes/layout_note.rb in rails3-footnotes-4.0.0.pre.4
- old
+ new
@@ -1,28 +1,26 @@
require "#{File.dirname(__FILE__)}/abstract_note"
module Footnotes
module Notes
class LayoutNote < AbstractNote
- def initialize(controller)
- @controller = controller
- end
def row
:edit
end
def link
escape(Footnotes::Filter.prefix(filename, 1, 1))
end
def valid?
- prefix? && nil#@controller.active_layout TODO doesn't work with Rails 3
+ prefix? && filename
end
- protected
- def filename
- File.join(File.expand_path(Rails.root), 'app', 'layouts', "#{@controller.active_layout.to_s.underscore}").sub('/layouts/layouts/', '/views/layouts/')
- end
+ protected
+ def filename
+ Dir[Footnotes.view_subscriber.layout.to_s+".html*"].first
+ end
+
end
end
end