Module: Props::PartialPatch
- Defined in:
- lib/props_template/partial_patch.rb
Instance Method Summary collapse
- #render(partial, context, block) ⇒ Object
- #render_partial_props_template(view, locals, template, layout, block) ⇒ Object
Instance Method Details
#render(partial, context, block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/props_template/partial_patch.rb', line 3 def render(partial, context, block) template = find_template(partial, template_keys(partial)) if !block && (layout = [:layout]) layout = find_template(layout.to_s, template_keys(partial)) end if template.respond_to?(:handler) && template.handler == Props::Handler && layout render_partial_props_template(context, @locals, template, layout, block) else super end end |
#render_partial_props_template(view, locals, template, layout, block) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/props_template/partial_patch.rb', line 17 def render_partial_props_template(view, locals, template, layout, block) ActiveSupport::Notifications.instrument( "render_partial.action_view", identifier: template.identifier, layout: layout && layout.virtual_path, locals: locals ) do |payload| body = if layout layout.render(view, locals, add_to_stack: !block) do |json| template.render(view, locals) end else template.render(view, locals) end build_rendered_template(body, template) end end |