Changeset 903

Show
Ignore:
Timestamp:
11/08/07 00:06:12 (1 year ago)
Author:
e.@brainspl.at
Message:

revert change

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/merb/mixins/render.rb

    r902 r903  
    150150      when status = opts[:nothing] 
    151151        return render_nothing(status) 
     152         
     153      when partial = opts[:partial] 
     154        opts[:format] ||= :html 
     155        template = find_partial(partial, opts) 
     156        opts[:layout] = :none 
     157         
     158        # Add an instance variable that can be used to create the locals in the 
     159        # partial 
     160        if opts[:locals] 
     161          @_merb_partial_locals = opts[:locals] 
     162        end 
     163        opts[:clean_context] = true 
     164         
    152165      when opts[:inline] 
    153166        text = opts.delete(:inline) 
     
    269282    # partials that live there like partial('shared/foo') 
    270283    def partial(template, locals={}) 
    271       choose_template_format(Merb.available_mime_types, {}) unless @_template_format 
    272       template = find_partial(template) 
    273       @_merb_partial_locals = locals 
    274       unless template 
    275         raise TemplateNotFound, "No template matched at #{unmatched}" 
    276       end 
    277  
    278       engine = Template.engine_for(template) 
    279       options = { 
    280         :file => template, 
    281         :view_context  => clean_view_context(engine), 
    282         :opts => {:locals => locals} 
    283       } 
    284       engine.transform(options) 
    285     end 
     284      options = {:partial => template, :locals => locals} 
     285      options.merge!(:format => @_template_format) if @_template_format 
     286      render options 
     287    end  
    286288 
    287289    # +catch_content+ catches the thrown content from another template 
  • trunk/lib/merb/template/erubis.rb

    r902 r903  
    3636        # Creates a new Erubis object to parse the template given in +path+. 
    3737        def new_eruby_obj(path) 
    38           if @@erbs[path] && MERB_ENV ==' production' 
     38          if @@erbs[path] && !cache_template?(path) 
    3939            return @@erbs[path] 
    4040          else   
  • trunk/spec/fixtures/views/examples/template_catch_content_from_partial.html.erb

    r902 r903  
    1 <% partial "examples/throw_content" %> 
     1<% render :partial => "examples/throw_content" %> 
    22 
    33<%= catch_content :from_partial %> 
    4 <% partial "examples/throw_content" %> 
     4<% render :partial => "examples/throw_content" %> 
    55 
    66<%= catch_content :from_partial %> 
  • trunk/spec/fixtures/views/partials/_haml.html.haml

    r902 r903  
    1 = respond_to?(:yo) ? yo : "No Locals!" 
     1= defined?(yo) && yo ? yo : "No Locals!" 
  • trunk/spec/fixtures/views/partials/_haml_new.html.haml

    r902 r903  
    1 = respond_to?(:yo) ? yo : "No Locals!" 
     1= defined?(yo) && yo ? yo : "No Locals!" 
  • trunk/spec/merb/render_spec.rb

    r902 r903  
    1212  it "should render a partial" do 
    1313    c = new_controller 
    14     content = c.partial "partials/#{@engine}" 
     14    content = c.render :partial => "partials/#{@engine}" 
    1515    content.clean.should == "No Locals!" 
    1616  end 
     
    1818  it "should render a partial with locals" do 
    1919    c = new_controller 
    20     content = c.partial "partials/#{@engine}", :yo => "Locals!"  
     20    content = c.render :partial => "partials/#{@engine}", :locals => { :yo => "Locals!" } 
    2121    content.clean.should == "Locals!" 
    2222  end 
     
    3636  it "should render a partial using the .format.engine convention" do 
    3737    c = new_controller 
    38     content = c.partial "partials/#{@engine}_new" 
     38    content = c.render :partial => "partials/#{@engine}_new" 
    3939    content.clean.should == "No Locals!" 
    4040  end 
     
    8686  it "should render #{@engine} partial using .format.engine convention#{" (caching on)" if defined?(cache) && cache}" do 
    8787    c = new_controller 
    88     content = c.partial "partials/#{@engine}_new" 
     88    content = c.render :partial => "partials/#{@engine}_new" 
    8989    content.clean.should == "No Locals!" 
    9090  end 
  • trunk/tools/allison/cache/BODY

    r902 r903  
    1 <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>%title%</title><link type="text/css" rel="stylesheet" href="%style_url%" media="screen"/><script type="text/javascript"> 
     1<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>%title%</title><link type="text/css" href="%style_url%" rel="stylesheet" media="screen"/><script type="text/javascript"> 
    22// Javascript for Allison RDoc template 
    33// Copyright 2006 Cloudburst LLC 
     
    402402</div> 
    403403ENDIF:methods 
    404 <div id="spacer"></div><div class="navigation dark index" id="class_wrapper"><div class="list_header"><h3>All classes</h3></div><div class="list_header_link"><a onclick="toggle('class'); toggleText('class_link'); return false;" id="class_link" href="#">Hide...</a></div><div class="clear"></div><div id="class"><form><label for="filter_class">Filter:&nbsp;&nbsp;</label><input type="text" onKeyPress="return disableSubmit(event);" id="filter_class" onKeyUp="return filterList('class', this.value, event);"></input></form></div></div><div class="navigation dark index" id="file_wrapper"><div class="list_header"><h3>All files</h3></div><div class="list_header_link"><a onclick="toggle('file'); toggleText('file_link'); return false;" id="file_link" href="#">Hide...</a></div><div class="clear"></div><div id="file"><form><label for="filter_file">Filter:&nbsp;&nbsp;</label><input type="text" onKeyPress="return disableSubmit(event);" id="filter_file" onKeyUp="return filterList('file', this.value, event);"></input></form></div></div><div class="navigation dark index" id="method_wrapper"><div class="list_header"><h3>All methods</h3></div><div class="list_header_link"><a onclick="toggle('method'); toggleText('method_link'); return false;" id="method_link" href="#">Show...</a></div><div class="clear"></div><div id="method"><form><label for="filter_method">Filter:&nbsp;&nbsp;</label><input type="text" onKeyPress="return disableSubmit(event);" id="filter_method" onKeyUp="return filterList('method', this.value, event);"></input></form></div></div><div class="curve" id="left_curve_0"></div><div class="curve" id="left_curve_1"></div><div class="curve" id="left_curve_2"></div><div class="curve" id="left_curve_3"></div><div class="curve" id="left_curve_4"></div><div class="curve" id="left_curve_5"></div><div class="curve" id="left_curve_6"></div><div class="curve" id="left_curve_7"></div><div class="curve" id="left_curve_8"></div><div class="curve" id="left_curve_9"></div></div><div id="content"> 
     404<div id="spacer"></div><div class="navigation dark index" id="class_wrapper"><div class="list_header"><h3>All classes</h3></div><div class="list_header_link"><a href="#" onclick="toggle('class'); toggleText('class_link'); return false;" id="class_link">Hide...</a></div><div class="clear"></div><div id="class"><form><label for="filter_class">Filter:&nbsp;&nbsp;</label><input type="text" onKeyPress="return disableSubmit(event);" id="filter_class" onKeyUp="return filterList('class', this.value, event);"></input></form></div></div><div class="navigation dark index" id="file_wrapper"><div class="list_header"><h3>All files</h3></div><div class="list_header_link"><a href="#" onclick="toggle('file'); toggleText('file_link'); return false;" id="file_link">Hide...</a></div><div class="clear"></div><div id="file"><form><label for="filter_file">Filter:&nbsp;&nbsp;</label><input type="text" onKeyPress="return disableSubmit(event);" id="filter_file" onKeyUp="return filterList('file', this.value, event);"></input></form></div></div><div class="navigation dark index" id="method_wrapper"><div class="list_header"><h3>All methods</h3></div><div class="list_header_link"><a href="#" onclick="toggle('method'); toggleText('method_link'); return false;" id="method_link">Show...</a></div><div class="clear"></div><div id="method"><form><label for="filter_method">Filter:&nbsp;&nbsp;</label><input type="text" onKeyPress="return disableSubmit(event);" id="filter_method" onKeyUp="return filterList('method', this.value, event);"></input></form></div></div><div class="curve" id="left_curve_0"></div><div class="curve" id="left_curve_1"></div><div class="curve" id="left_curve_2"></div><div class="curve" id="left_curve_3"></div><div class="curve" id="left_curve_4"></div><div class="curve" id="left_curve_5"></div><div class="curve" id="left_curve_6"></div><div class="curve" id="left_curve_7"></div><div class="curve" id="left_curve_8"></div><div class="curve" id="left_curve_9"></div></div><div id="content"> 
    405405IF:title 
    406406<h1 id="item_name">%title%</h1> 
     
    572572 
    573573IF:sourcecode 
    574 <p class="source_link" id="%aref%-show-link"><a onclick="toggle('%aref%-source'); toggleText('%aref%-link'); return false;" id="%aref%-link" href="#">Show source...</a></p><div class="source" id="%aref%-source"><pre>%sourcecode%</pre></div> 
     574<p class="source_link" id="%aref%-show-link"><a href="#" onclick="toggle('%aref%-source'); toggleText('%aref%-link'); return false;" id="%aref%-link">Show source...</a></p><div class="source" id="%aref%-source"><pre>%sourcecode%</pre></div> 
    575575ENDIF:sourcecode 
    576576</div></div> 
  • trunk/tools/allison/cache/INDEX

    r902 r903  
    1 <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>%title%</title><link type="text/css" rel="stylesheet" href="rdoc-style.css" media="screen"/><meta content="0;url=%initial_page%" http-equiv="refresh"/></head><body><div id="container"><div class="curve" id="preheader_curve_0"></div><div class="curve" id="preheader_curve_1"></div><div class="curve" id="preheader_curve_2"></div><div class="curve" id="preheader_curve_3"></div><div class="curve" id="preheader_curve_4"></div><div class="curve" id="preheader_curve_5"></div><div class="curve" id="preheader_curve_6"></div><div class="curve" id="preheader_curve_7"></div><div class="curve" id="preheader_curve_8"></div><div class="curve" id="preheader_curve_9"></div><div id="header"><span id="title"><p>&nbsp;</p><h1>Ruby Documentation</h1></span></div><div class="clear"></div><div id="redirect"><a href="%initial_page%"><h1>Redirect</h1></a></div></div></body></html> 
     1<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>%title%</title><link type="text/css" href="rdoc-style.css" rel="stylesheet" media="screen"/><meta content="0;url=%initial_page%" http-equiv="refresh"/></head><body><div id="container"><div class="curve" id="preheader_curve_0"></div><div class="curve" id="preheader_curve_1"></div><div class="curve" id="preheader_curve_2"></div><div class="curve" id="preheader_curve_3"></div><div class="curve" id="preheader_curve_4"></div><div class="curve" id="preheader_curve_5"></div><div class="curve" id="preheader_curve_6"></div><div class="curve" id="preheader_curve_7"></div><div class="curve" id="preheader_curve_8"></div><div class="curve" id="preheader_curve_9"></div><div id="header"><span id="title"><p>&nbsp;</p><h1>Ruby Documentation</h1></span></div><div class="clear"></div><div id="redirect"><a href="%initial_page%"><h1>Redirect</h1></a></div></div></body></html>