lib/edifice/renderer.rb in edifice-1.1.1 vs lib/edifice/renderer.rb in edifice-1.2.0
- old
+ new
@@ -9,13 +9,16 @@
end
end
class TemplateRenderer < ActionView::TemplateRenderer
def render_template(template, layout_name = nil, locals = {})
+ layout_name = layout_name.call if layout_name.is_a? Proc
+ layout = if layout_name.is_a? String then layout_name.split('/').last else '' end
+
# 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))
+ template.virtual_path.prefix, layout)
end
super(template, layout_name, locals)
end
end
\ No newline at end of file