Sha256: 9a155f789805d02e57fc523cf22461ea34670cc3fe1b9f3d43c6a2c8a48fbe32

Contents?: true

Size: 696 Bytes

Versions: 3

Compression:

Stored size: 696 Bytes

Contents

require "#{File.dirname(__FILE__)}/abstract_note"

module Footnotes
  module Notes
    class ViewNote < AbstractNote
      def initialize(controller)
        @controller = controller
        @template = controller.instance_variable_get(:@template)
      end

      def row
        :edit
      end

      def link
        escape(Footnotes::Filter.prefix(filename, 1, 1))
      end

      def valid?
        prefix? && first_render?
      end

      protected
        def first_render?
          @template.instance_variable_get(:@_first_render)
        end
        
        def filename
          @filename ||= @template.instance_variable_get(:@_first_render).filename
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
josevalim-rails-footnotes-3.3.1 lib/notes/view_note.rb
josevalim-rails-footnotes-3.3.2 lib/notes/view_note.rb
lexrupy-rails-footnotes-3.3.2 lib/rails-footnotes/notes/view_note.rb