Changeset 8541
- Timestamp:
- 01/03/08 15:28:36 (4 months ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_view/base.rb (modified) (2 diffs)
- trunk/actionpack/test/controller/new_render_test.rb (modified) (3 diffs)
- trunk/actionpack/test/fixtures/layouts/block_with_layout.erb (added)
- trunk/actionpack/test/fixtures/layouts/partial_with_layout.erb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r8529 r8541 1 1 *SVN* 2 3 * Fixed rendering of partials with layout when done from site layout #9209 [antramm] 2 4 3 5 * Fix atom_feed_helper to comply with the atom spec. Closes #10672 [xaviershay] trunk/actionpack/lib/action_view/base.rb
r8404 r8541 339 339 340 340 if block_given? 341 @content_for_layout = capture(&block) 342 concat(render(options.merge(:partial => "#{path}/#{partial_name}")), block.binding) 341 wrap_content_for_layout capture(&block) do 342 concat(render(options.merge(:partial => "#{path}/#{partial_name}")), block.binding) 343 end 343 344 else 344 @content_for_layout = render(options) 345 render(options.merge(:partial => "#{path}/#{partial_name}")) 345 wrap_content_for_layout render(options) do 346 render(options.merge(:partial => "#{path}/#{partial_name}")) 347 end 346 348 end 347 349 elsif options[:file] … … 442 444 443 445 private 446 def wrap_content_for_layout(content) 447 original_content_for_layout = @content_for_layout 448 @content_for_layout = content 449 returning(yield) { @content_for_layout = original_content_for_layout } 450 end 451 444 452 def find_full_template_path(template_path, extension) 445 453 file_name = "#{template_path}.#{extension}" trunk/actionpack/test/controller/new_render_test.rb
r8499 r8541 362 362 end 363 363 364 def render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout 365 render :action => "calling_partial_with_layout" 366 end 367 364 368 def render_using_layout_around_block 365 369 render :action => "using_layout_around_block" 366 370 end 367 371 372 def render_using_layout_around_block_in_main_layout_and_within_content_for_layout 373 render :action => "using_layout_around_block" 374 end 375 368 376 def rescue_action(e) raise end 369 377 … … 388 396 when "action_talk_to_layout", "layout_overriding_layout" 389 397 "layouts/talk_from_action" 398 when "render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout" 399 "layouts/partial_with_layout" 400 when "render_using_layout_around_block_in_main_layout_and_within_content_for_layout" 401 "layouts/block_with_layout" 390 402 end 391 403 end … … 826 838 assert_equal "Before (David)\nInside from partial (David)\nAfter", @response.body 827 839 end 828 840 841 def test_render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout 842 get :render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout 843 assert_equal "Before (Anthony)\nInside from partial (Anthony)\nAfter\nBefore (David)\nInside from partial (David)\nAfter\nBefore (Ramm)\nInside from partial (Ramm)\nAfter", @response.body 844 end 845 829 846 def test_using_layout_around_block 830 get : using_layout_around_block847 get :render_using_layout_around_block 831 848 assert_equal "Before (David)\nInside from block\nAfter", @response.body 832 849 end 850 851 def test_using_layout_around_block_in_main_layout_and_within_content_for_layout 852 get :render_using_layout_around_block_in_main_layout_and_within_content_for_layout 853 assert_equal "Before (Anthony)\nInside from first block in layout\nAfter\nBefore (David)\nInside from block\nAfter\nBefore (Ramm)\nInside from second block in layout\nAfter\n", @response.body 854 end 855 833 856 end