提交 39766a9b 编写于 作者: M Marcel Molina

Don't include a layout when rendering an rjs template using render's :template option.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3316 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 5f06c483
*SVN* *SVN*
* Don't include a layout when rendering an rjs template using render's :template option. [Marcel Molina Jr.]
* Update to script.aculo.us 1.5.0 final (equals 1.5.0_rc6) [Thomas Fuchs] * Update to script.aculo.us 1.5.0 final (equals 1.5.0_rc6) [Thomas Fuchs]
* Update to Prototype 1.4.0 final [Sam Stephenson] * Update to Prototype 1.4.0 final [Sam Stephenson]
......
...@@ -937,7 +937,17 @@ def assert_existance_of_template_file(template_name) ...@@ -937,7 +937,17 @@ def assert_existance_of_template_file(template_name)
end end
def default_template_name(default_action_name = action_name) def default_template_name(default_action_name = action_name)
default_action_name = default_action_name.dup
strip_out_controller!(default_action_name) if template_path_includes_controller?(default_action_name)
"#{self.class.controller_path}/#{default_action_name}" "#{self.class.controller_path}/#{default_action_name}"
end end
def strip_out_controller!(path)
path.replace path.split('/', 2).last
end
def template_path_includes_controller?(path)
path.to_s['/'] && self.class.controller_path.split('/')[-1] == path.split('/')[0]
end
end end
end end
...@@ -237,7 +237,7 @@ def apply_layout?(template_with_options, options) ...@@ -237,7 +237,7 @@ def apply_layout?(template_with_options, options)
def candidate_for_layout?(options) def candidate_for_layout?(options)
(options.has_key?(:layout) && options[:layout] != false) || (options.has_key?(:layout) && options[:layout] != false) ||
options.values_at(:text, :file, :inline, :partial, :nothing).compact.empty? && options.values_at(:text, :file, :inline, :partial, :nothing).compact.empty? &&
!template_exempt_from_layout?(default_template_name(options[:action])) !template_exempt_from_layout?(default_template_name(options[:action] || options[:template]))
end end
def pick_layout(template_with_options, options, deprecated_layout) def pick_layout(template_with_options, options, deprecated_layout)
......
...@@ -209,7 +209,10 @@ def determine_layout ...@@ -209,7 +209,10 @@ def determine_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" "render_js_with_explicit_template",
"render_js_with_explicit_action_template",
"delete_with_js"
"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.
先完成此消息的编辑!
想要评论请 注册