mirror of
https://github.com/github/rails.git
synced 2026-01-30 00:38:00 -05:00
Assume that rendered partials go by the HTML format by default
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6734 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
*SVN*
|
||||
|
||||
* Assume that rendered partials go by the HTML format by default
|
||||
|
||||
def my_partial
|
||||
render :update do |page|
|
||||
# in this order
|
||||
# _foo.html.erb
|
||||
# _foo.erb
|
||||
# _foo.rhtml
|
||||
page.replace :foo, :partial => 'foo'
|
||||
end
|
||||
end
|
||||
|
||||
* Added record identifications to FormHelper#form_for and PrototypeHelper#remote_form_for [DHH]. Examples:
|
||||
|
||||
<% form_for(@post) do |f| %>
|
||||
|
||||
@@ -403,19 +403,7 @@ module ActionView #:nodoc:
|
||||
|
||||
# symbolized version of the :format parameter of the request, or :html by default.
|
||||
def template_format
|
||||
if @template_format.nil?
|
||||
@template_format =
|
||||
begin
|
||||
if controller.request.accepts.first == Mime::JS
|
||||
:js
|
||||
else
|
||||
controller.request.parameters[:format].to_sym
|
||||
end
|
||||
rescue
|
||||
:html
|
||||
end
|
||||
end
|
||||
@template_format
|
||||
@template_format ||= controller.request.parameters[:format].to_sym rescue :html
|
||||
end
|
||||
|
||||
def template_handler_preferences
|
||||
|
||||
@@ -132,6 +132,16 @@ class TestController < ActionController::Base
|
||||
@foo = render_to_string :inline => "this is a test"
|
||||
end
|
||||
|
||||
def partial
|
||||
render :partial => 'partial'
|
||||
end
|
||||
|
||||
def partial_as_rjs
|
||||
render :update do |page|
|
||||
page.replace :foo, :partial => 'partial'
|
||||
end
|
||||
end
|
||||
|
||||
def rescue_action(e) raise end
|
||||
|
||||
private
|
||||
@@ -368,6 +378,15 @@ class RenderTest < Test::Unit::TestCase
|
||||
assert_equal '<test>passed formatted html erb</test>', @response.body
|
||||
end
|
||||
|
||||
def test_should_render_html_formatted_partial
|
||||
get :partial
|
||||
assert_equal 'partial html', @response.body
|
||||
end
|
||||
|
||||
def test_should_render_html_formatted_partial_with_rjs
|
||||
xhr :get, :partial_as_rjs
|
||||
assert_equal %(Element.replace("foo", "partial html");), @response.body
|
||||
end
|
||||
|
||||
protected
|
||||
def assert_deprecated_render(&block)
|
||||
|
||||
1
actionpack/test/fixtures/test/_partial.erb
vendored
Normal file
1
actionpack/test/fixtures/test/_partial.erb
vendored
Normal file
@@ -0,0 +1 @@
|
||||
invalid
|
||||
1
actionpack/test/fixtures/test/_partial.html.erb
vendored
Normal file
1
actionpack/test/fixtures/test/_partial.html.erb
vendored
Normal file
@@ -0,0 +1 @@
|
||||
partial html
|
||||
0
actionpack/test/fixtures/test/_partial.rhtml
vendored
Normal file
0
actionpack/test/fixtures/test/_partial.rhtml
vendored
Normal file
Reference in New Issue
Block a user