Sha256: 4787edba1c6d0d6c5edb2912a73a9f39f9945f2c35f2ff57c6b045c7813ee6b2

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 Bytes

Contents

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

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

      def row
        :edit
      end

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

      def valid?
        prefix? && @controller.active_layout && layout_template
      end

      protected
        def layout_template
          @layout_template ||= @template.send(:_pick_template, @controller.active_layout)
        end

        def layout_filename
          layout_template.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/layout_note.rb
josevalim-rails-footnotes-3.3.2 lib/notes/layout_note.rb
lexrupy-rails-footnotes-3.3.2 lib/rails-footnotes/notes/layout_note.rb