diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-08-07 03:48:28 -0300 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-08-07 03:48:28 -0300 |
commit | 59e475e3a66fe647ea74f4daf472d82bc9b4535c (patch) | |
tree | 745ebffaa77cef7bff5ab82605bae6c8bf965f99 /actionpack/lib/action_view/render/partials.rb | |
parent | 0612fd0f09977dece11a0325a0d7ee07c5cab35c (diff) | |
download | rails-59e475e3a66fe647ea74f4daf472d82bc9b4535c.tar.gz rails-59e475e3a66fe647ea74f4daf472d82bc9b4535c.tar.bz2 rails-59e475e3a66fe647ea74f4daf472d82bc9b4535c.zip |
Some more AV work:
* rename _render_partial to _render_partial_unknown_type to reflect that for this call,
we don't know the type.
* Merge _render_partial_with_block and _render_partial_with_layout to _render_partial
* TODO: Check to see if any more logic can be shared
* TODO: See about streamlining block path so we can get rid of @_proc_for_layout
* Remove @exempt_from_layout as it is no longer needed
Diffstat (limited to 'actionpack/lib/action_view/render/partials.rb')
-rw-r--r-- | actionpack/lib/action_view/render/partials.rb | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb index 98694788f8..8e094240d3 100644 --- a/actionpack/lib/action_view/render/partials.rb +++ b/actionpack/lib/action_view/render/partials.rb @@ -185,10 +185,10 @@ module ActionView def render_partial(options) @assigns_added = false - _render_partial(options) + _render_partial_unknown_type(options) end - def _render_partial(options) #:nodoc: + def _render_partial_unknown_type(options) #:nodoc: options[:locals] ||= {} path = partial = options[:partial] @@ -220,19 +220,21 @@ module ActionView end end - def _render_partial_with_block(layout, block, options) - @_proc_for_layout = block - concat(_render_partial(options.merge(:partial => layout))) - ensure - @_proc_for_layout = nil - end - - def _render_partial_with_layout(layout, options) - if layout - prefix = layout.include?(?/) ? nil : controller_path - layout = find_by_parts(layout, {:formats => formats}, prefix, true) + def _render_partial(layout, options, block = nil) + if block + begin + @_proc_for_layout = block + concat(_render_partial_unknown_type(options.merge(:partial => layout))) + ensure + @_proc_for_layout = nil + end + else + if layout + prefix = layout.include?(?/) ? nil : controller_path + layout = find_by_parts(layout, {:formats => formats}, prefix, true) + end + _render_content(_render_partial_unknown_type(options), layout, options[:locals]) end - _render_content(_render_partial(options), layout, options[:locals]) end def _render_partial_object(template, options) @@ -260,7 +262,8 @@ module ActionView def _render_partial_collection(collection, options = {}, passed_template = nil) #:nodoc: return nil if collection.blank? - spacer = options[:spacer_template] ? _render_partial(:partial => options[:spacer_template]) : '' + spacer = options[:spacer_template] ? + _render_partial_unknown_type(:partial => options[:spacer_template]) : '' locals = (options[:locals] ||= {}) index, @_partial_path = 0, nil |