Module: Props::LayoutPatch
- Defined in:
- lib/props_template/layout_patch.rb
Instance Method Summary collapse
- #render_props_template(view, template, path, locals) ⇒ Object
- #render_template(view, template, layout_name, locals) ⇒ Object
Instance Method Details
#render_props_template(view, template, path, locals) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/props_template/layout_patch.rb', line 18 def render_props_template(view, template, path, locals) layout = resolve_layout(path, locals.keys, [formats.first]) body = if layout layout.render(view, locals) do |json| template.render(view, locals) end else template.render(view, locals) end build_rendered_template(body, template) end |
#render_template(view, template, layout_name, locals) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/props_template/layout_patch.rb', line 3 def render_template(view, template, layout_name, locals) if !view.respond_to?(:active_template_virtual_path) && template.respond_to?(:virtual_path) view.instance_eval " def active_template_virtual_path; \"\#{template.virtual_path}\";end\n RUBY\n end\n\n if template.respond_to?(:handler) && template.handler == Props::Handler && layout_name\n prepend_formats(template.format)\n render_props_template(view, template, layout_name, locals)\n else\n super\n end\nend\n", __FILE__, __LINE__ + 1 |