Render implicit html template when xhr request now supports localization [#1886 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
This commit is contained in:
parent
f98d8ee72b
commit
50f51ff950
|
@ -50,6 +50,8 @@ module ActionView #:nodoc:
|
|||
elsif template = load_path[template_path]
|
||||
return template
|
||||
# Try to find html version if the format is javascript
|
||||
elsif format == :js && template = load_path["#{template_path}.#{I18n.locale}.html"]
|
||||
return template
|
||||
elsif format == :js && template = load_path["#{template_path}.html"]
|
||||
return template
|
||||
end
|
||||
|
|
1
actionpack/test/fixtures/test/render_implicit_html_template_from_xhr_request.da.html.erb
vendored
Normal file
1
actionpack/test/fixtures/test/render_implicit_html_template_from_xhr_request.da.html.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
Hey HTML!
|
|
@ -44,6 +44,25 @@ module RenderTestCases
|
|||
I18n.locale = old_locale
|
||||
end
|
||||
|
||||
def test_render_implicit_html_template_from_xhr_request
|
||||
old_format = @view.template_format
|
||||
@view.template_format = :js
|
||||
assert_equal "Hello HTML!", @view.render(:file => "test/render_implicit_html_template_from_xhr_request")
|
||||
ensure
|
||||
@view.template_format = old_format
|
||||
end
|
||||
|
||||
def test_render_implicit_html_template_from_xhr_request_with_localization
|
||||
old_locale = I18n.locale
|
||||
old_format = @view.template_format
|
||||
I18n.locale = :da
|
||||
@view.template_format = :js
|
||||
assert_equal "Hey HTML!\n", @view.render(:file => "test/render_implicit_html_template_from_xhr_request")
|
||||
ensure
|
||||
I18n.locale = old_locale
|
||||
@view.template_format = old_format
|
||||
end
|
||||
|
||||
def test_render_file_at_top_level
|
||||
assert_equal 'Elastica', @view.render(:file => '/shared')
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue