Class: PufferPages::Renderer

Inherits:
ActionView::TemplateRenderer
  • Object
show all
Defined in:
lib/puffer_pages/renderer.rb

Instance Method Summary collapse

Instance Method Details

#determine_template(options) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/puffer_pages/renderer.rb', line 8

def determine_template(options)
  @view.assign(@view.assigns.merge!('puffer_page' => options[:puffer_page]))

  super
rescue ActionView::MissingTemplate
  options[:text] = ''
  super
end

#find_layout(layout, keys) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/puffer_pages/renderer.rb', line 17

def find_layout(layout, keys)
  layout = "<%= render(:inline => @puffer_page.render(puffer_pages_context),
    :layout => @puffer_page.layout_for_render) %>"

  handler = ActionView::Template.handler_for_extension("erb")
  ActionView::Template.new(layout, "puffer pages layout wrapper", handler, :locals => keys)
end

#render(context, options) ⇒ Object



3
4
5
6
# File 'lib/puffer_pages/renderer.rb', line 3

def render(context, options)
  @view = context
  super
end