Sha256: 65b9a2b4106a66fbe24b75d032e15b9d2c403c7b4c54d290b2e7a4ed9efe351a

Contents?: true

Size: 546 Bytes

Versions: 3

Compression:

Stored size: 546 Bytes

Contents

module Deface
  module TemplateHelper

    # used to find source for a partial or template using virutal_path
    def load_template_source(virtual_path, partial)
      parts = virtual_path.split("/")

      if parts.size == 2
        prefix = ""
        name = virtual_path
      else
        prefix = parts.shift
        name = parts.join("/")
      end

      @lookup_context ||= ActionView::LookupContext.new(ActionController::Base.view_paths, {:formats => [:html]})

      @lookup_context.find(name, prefix, partial).source
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deface-0.5.0 lib/deface/template_helper.rb
deface-0.4.0 lib/deface/template_helper.rb
deface-0.3.0 lib/deface/template_helper.rb