Merge branch 'master' of git://github.com/rails/rails into old
This commit is contained in:
commit
e45e120af9
@ -88,6 +88,22 @@ def _layout(details)
|
||||
end
|
||||
end
|
||||
|
||||
def render_to_body(options = {})
|
||||
response = super
|
||||
|
||||
if options.key?(:partial)
|
||||
# This is a little bit messy. We need to explicitly handle partial
|
||||
# layouts here since the core lookup logic is in the view, but
|
||||
# we need to determine the layout based on the controller
|
||||
if options.key?(:layout)
|
||||
layout = _layout_for_option(options[:layout], options[:_template].details)
|
||||
response = layout.render(view_context, options[:locals]) { response }
|
||||
end
|
||||
end
|
||||
|
||||
response
|
||||
end
|
||||
|
||||
private
|
||||
# This will be overwritten by _write_layout_method
|
||||
def _layout(details) end
|
||||
|
@ -54,7 +54,7 @@ def render(*args)
|
||||
# :api: plugin
|
||||
def render_to_body(options = {})
|
||||
# TODO: Refactor so we can just use the normal template logic for this
|
||||
if options.key?(:_partial_object)
|
||||
if options.key?(:partial)
|
||||
view_context.render_partial(options)
|
||||
else
|
||||
_determine_template(options)
|
||||
|
@ -22,7 +22,8 @@ def render_to_body(options)
|
||||
_process_options(options)
|
||||
|
||||
if options.key?(:partial)
|
||||
_render_partial(options[:partial], options)
|
||||
options[:partial] = action_name if options[:partial] == true
|
||||
options[:_details] = {:formats => formats}
|
||||
end
|
||||
|
||||
super
|
||||
@ -53,18 +54,6 @@ def _determine_template(options)
|
||||
end
|
||||
|
||||
def _render_partial(partial, options)
|
||||
case partial
|
||||
when true
|
||||
options[:_prefix] = _prefix
|
||||
when String
|
||||
options[:_prefix] = _prefix unless partial.include?(?/)
|
||||
options[:_template_name] = partial
|
||||
else
|
||||
options[:_partial_object] = true
|
||||
return
|
||||
end
|
||||
|
||||
options[:_partial] = options[:object] || true
|
||||
end
|
||||
|
||||
def _process_options(options)
|
||||
|
@ -185,6 +185,8 @@ def _partial_names
|
||||
|
||||
def render_partial(options)
|
||||
@assigns_added = false
|
||||
# TODO: Handle other details here.
|
||||
self.formats = options[:_details][:formats]
|
||||
_render_partial(options)
|
||||
end
|
||||
|
||||
@ -235,6 +237,8 @@ def _render_partial_object(template, options, &block)
|
||||
end
|
||||
|
||||
def _render_partial_collection(collection, options = {}, template = nil, &block) #:nodoc:
|
||||
options[:_template] ||= template
|
||||
|
||||
return nil if collection.blank?
|
||||
|
||||
if options.key?(:spacer_template)
|
||||
|
Loading…
Reference in New Issue
Block a user