提交 62fe5bbf 编写于 作者: M Marcel Molina

Make rjs templates always implicitly skip out on layouts.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 97d5f4ac
*SVN* *SVN*
* Make rjs templates always implicitly skip out on layouts. [Marcel Molina Jr.]
* Correct length for the truncate text helper. #2913 [Stefan Kaes] * Correct length for the truncate text helper. #2913 [Stefan Kaes]
* Update to Prototype 1.4.0_rc3. Closes #1893, #2505, #2550, #2748, #2783. [Sam Stephenson] * Update to Prototype 1.4.0_rc3. Closes #1893, #2505, #2550, #2748, #2783. [Sam Stephenson]
......
...@@ -637,10 +637,11 @@ def render_to_string(options = nil) #:doc: ...@@ -637,10 +637,11 @@ def render_to_string(options = nil) #:doc:
end end
def render_action(action_name, status = nil, with_layout = true) def render_action(action_name, status = nil, with_layout = true)
if with_layout template = default_template_name(action_name)
render_with_layout(default_template_name(action_name), status) if with_layout && !template_exempt_from_layout?(template)
render_with_layout(template, status)
else else
render_with_no_layout(default_template_name(action_name), status) render_without_layout(template, status)
end end
end end
...@@ -919,6 +920,10 @@ def template_public?(template_name = default_template_name) ...@@ -919,6 +920,10 @@ def template_public?(template_name = default_template_name)
@template.file_public?(template_name) @template.file_public?(template_name)
end end
def template_exempt_from_layout?(template_name = default_template_name)
@template.javascript_template_exists?(template_name)
end
def assert_existance_of_template_file(template_name) def assert_existance_of_template_file(template_name)
unless template_exists?(template_name) || ignore_missing_templates unless template_exists?(template_name) || ignore_missing_templates
full_template_path = @template.send(:full_template_path, template_name, 'rhtml') full_template_path = @template.send(:full_template_path, template_name, 'rhtml')
......
...@@ -229,11 +229,13 @@ def render_with_a_layout(options = nil, deprecated_status = nil, deprecated_layo ...@@ -229,11 +229,13 @@ def render_with_a_layout(options = nil, deprecated_status = nil, deprecated_layo
private private
def apply_layout?(template_with_options, options) def apply_layout?(template_with_options, options)
if template_with_options template_with_options ? candidate_for_layout?(options) : !template_exempt_from_layout?
(options.has_key?(:layout) && options[:layout]!=false) || options.values_at(:text, :file, :inline, :partial, :nothing).compact.empty? end
else
true def candidate_for_layout?(options)
end (options.has_key?(:layout) && options[:layout] != false) ||
options.values_at(:text, :file, :inline, :partial, :nothing).compact.empty? &&
!template_exempt_from_layout?(default_template_name(options[:action]))
end end
def pick_layout(template_with_options, options, deprecated_layout) def pick_layout(template_with_options, options, deprecated_layout)
......
...@@ -192,7 +192,8 @@ def determine_layout ...@@ -192,7 +192,8 @@ def determine_layout
"partial_only", "partial_only_with_layout", "partial_only", "partial_only_with_layout",
"accessing_params_in_template", "accessing_params_in_template",
"accessing_params_in_template_with_layout", "accessing_params_in_template_with_layout",
"render_with_explicit_template" "render_with_explicit_template",
"test_rendering_rjs_action_explicitly"
"layouts/standard" "layouts/standard"
when "builder_layout_test" when "builder_layout_test"
"layouts/builder" "layouts/builder"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册