Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 3316

Show
Ignore:
Timestamp:
12/17/05 06:38:06 (3 years ago)
Author:
marcel
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r3301 r3316  
    11*SVN* 
     2 
     3* Don't include a layout when rendering an rjs template using render's :template option. [Marcel Molina Jr.] 
    24 
    35* Update to script.aculo.us 1.5.0 final (equals 1.5.0_rc6) [Thomas Fuchs] 
  • trunk/actionpack/lib/action_controller/base.rb

    r3157 r3316  
    938938 
    939939      def default_template_name(default_action_name = action_name) 
     940        default_action_name = default_action_name.dup 
     941        strip_out_controller!(default_action_name) if template_path_includes_controller?(default_action_name) 
    940942        "#{self.class.controller_path}/#{default_action_name}" 
     943      end 
     944       
     945      def strip_out_controller!(path) 
     946        path.replace path.split('/', 2).last 
     947      end 
     948       
     949      def template_path_includes_controller?(path) 
     950        path.to_s['/'] && self.class.controller_path.split('/')[-1] == path.split('/')[0] 
    941951      end 
    942952  end 
  • trunk/actionpack/lib/action_controller/layout.rb

    r3111 r3316  
    238238        (options.has_key?(:layout) && options[:layout] != false) ||  
    239239        options.values_at(:text, :file, :inline, :partial, :nothing).compact.empty? && 
    240         !template_exempt_from_layout?(default_template_name(options[:action])) 
     240        !template_exempt_from_layout?(default_template_name(options[:action] || options[:template])) 
    241241      end 
    242242 
  • trunk/actionpack/test/controller/new_render_test.rb

    r3157 r3316  
    210210             "accessing_params_in_template_with_layout", 
    211211             "render_with_explicit_template", 
    212              "test_rendering_rjs_action_explicitly" 
     212             "render_js_with_explicit_template", 
     213             "render_js_with_explicit_action_template", 
     214             "delete_with_js" 
     215     
    213216          "layouts/standard" 
    214217        when "builder_layout_test"