Sha256: 88d385dbff58b9c0794ac6e100d91fb526319ecae24a797788c6a4751d3303cd

Contents?: true

Size: 782 Bytes

Versions: 10

Compression:

Stored size: 782 Bytes

Contents

module Edifice
  module Renderer
    def self.included(renderer)
      renderer.class_eval do
        def _template_renderer #:nodoc:
          @_template_renderer ||= Edifice::TemplateRenderer.new(@lookup_context)
        end
      end
    end
  end

  class TemplateRenderer < ActionView::TemplateRenderer
    def render_template(template, layout_name = nil, locals = {})
      # ensure we aren't rendering e.g. text
      if template.respond_to?(:virtual_path) and @view.controller and @view.controller.respond_to?(:set_edifice_names)
        @view.controller.set_edifice_names(template.virtual_path.name, 
          template.virtual_path.prefix, (layout_name.nil? ? '' : layout_name.split('/').last))
      end
      
      super(template, layout_name, locals)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
edifice-1.1.1 lib/edifice/renderer.rb
edifice-1.1.0 lib/edifice/renderer.rb
edifice-1.0 lib/edifice/renderer.rb
edifice-0.10.3 lib/edifice/renderer.rb
edifice-0.10.2 lib/edifice/renderer.rb
edifice-0.10.1 lib/edifice/renderer.rb
edifice-0.10.0 lib/edifice/renderer.rb
edifice-0.9.0 lib/edifice/renderer.rb
edifice-0.8.0 lib/edifice/renderer.rb
edifice-0.7.3 lib/edifice/renderer.rb