Changeset 7514
- Timestamp:
- 09/18/07 23:10:34 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r7487 r7514 1 1 *SVN* 2 3 * Fixed that default layouts did not take the format into account #9564 [lifofifo] 2 4 3 5 * Fixed optimized route segment escaping. #9562 [wildchild, Jeremy Kemper] trunk/actionpack/lib/action_controller/layout.rb
r7438 r7514 235 235 protected 236 236 def render_with_a_layout(options = nil, &block) #:nodoc: 237 template_with_options = options.is_a?(Hash) 237 if template_with_options = options.is_a?(Hash) 238 response.template.template_format = options[:content_type].to_sym if options[:content_type] 239 end 238 240 239 241 if apply_layout?(template_with_options, options) && (layout = pick_layout(template_with_options, options)) trunk/actionpack/test/controller/mime_responds_test.rb
r7479 r7514 113 113 type.js 114 114 end 115 end 116 117 def iphone_with_html_response_type 118 Mime::Type.register("text/iphone", :iphone) 119 120 respond_to do |type| 121 type.html { @type = "Firefox" } 122 type.iphone { @type = "iPhone"; render :content_type => Mime::HTML } 123 end 124 125 Mime.send :remove_const, :IPHONE 115 126 end 116 127 … … 121 132 protected 122 133 def set_layout 123 if action_name == "all_types_with_layout"134 if ["all_types_with_layout", "iphone_with_html_response_type"].include?(action_name) 124 135 "standard" 125 136 end … … 381 392 get :using_defaults, :format => "xml" 382 393 assert_equal "using_defaults - xml", @response.body 383 end 394 end 395 396 def test_format_with_custom_response_type 397 get :iphone_with_html_response_type 398 assert_equal "<html>Hello future from Firefox!</html>", @response.body 399 400 get :iphone_with_html_response_type, :format => "iphone" 401 assert_equal "text/html", @response.content_type 402 assert_equal "<html>Hello future from iPhone!</html>", @response.body 403 end 404 405 def test_format_with_custom_response_type_and_request_headers 406 @request.env["HTTP_ACCEPT"] = "text/iphone" 407 get :iphone_with_html_response_type 408 assert_equal "<html>Hello future from iPhone!</html>", @response.body 409 assert_equal "text/html", @response.content_type 410 end 384 411 end