diff options
author | Marcel Molina <marcel@vernix.org> | 2005-12-17 06:38:06 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2005-12-17 06:38:06 +0000 |
commit | 39766a9b4cde8f75a5837442b876e1e11a16ece4 (patch) | |
tree | 0fdd15d674e64a1c1281e2cce7d6e0764b4cde5c | |
parent | 5f06c483ca6a0434409aa12ec272654bc26735dd (diff) | |
download | rails-39766a9b4cde8f75a5837442b876e1e11a16ece4.tar.gz rails-39766a9b4cde8f75a5837442b876e1e11a16ece4.tar.bz2 rails-39766a9b4cde8f75a5837442b876e1e11a16ece4.zip |
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
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 10 | ||||
-rw-r--r-- | actionpack/lib/action_controller/layout.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/new_render_test.rb | 5 |
4 files changed, 17 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 939e9f5b8f..d8a898f8ef 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *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 Prototype 1.4.0 final [Sam Stephenson] diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 9aab2c5028..c1adbf3b8a 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -937,7 +937,17 @@ module ActionController #:nodoc: end 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}" 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 diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index d6a4789bef..3ec125f088 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -237,7 +237,7 @@ module ActionController #:nodoc: def candidate_for_layout?(options) (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])) + !template_exempt_from_layout?(default_template_name(options[:action] || options[:template])) end def pick_layout(template_with_options, options, deprecated_layout) diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb index a1ed9f71d0..5652803e1d 100644 --- a/actionpack/test/controller/new_render_test.rb +++ b/actionpack/test/controller/new_render_test.rb @@ -209,7 +209,10 @@ class NewRenderTestController < ActionController::Base "accessing_params_in_template", "accessing_params_in_template_with_layout", "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" when "builder_layout_test" "layouts/builder" |