Changeset 806

Show
Ignore:
Timestamp:
04/18/08 15:46:58 (3 months ago)
Author:
seancribbs
Message:

Merge branch 'master' of git://github.com/AndrewO/radiant

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/radiant/app/models/standard_tags.rb

    r782 r806  
    438438    end 
    439439  end 
    440    
    441   desc %{ 
    442     Inside this tag all page related tags refer to the page found at the @url@ attribute. 
     440 
     441  desc %{ 
     442    Inside this tag all page related tags refer to the page found at the @url@ attribute.   
     443    @url@s may be relative or absolute paths. 
    443444     
    444445    *Usage:* 
     
    446447  } 
    447448  tag 'find' do |tag| 
    448     if url = tag.attr['url'] 
    449       if found = Page.find_by_url(tag.attr['url']) 
    450         unless FileNotFoundPage === found 
    451           tag.locals.page = found 
    452           tag.expand 
    453         end 
    454       end 
    455     else 
    456       raise TagError.new("`find' tag must contain `url' attribute") 
     449    url = tag.attr['url'] 
     450    raise TagError.new("`find' tag must contain `url' attribute") unless url 
     451     
     452    found = Page.find_by_url(absolute_path_for(tag.locals.page.url, url)) 
     453    if page_found?(found) 
     454      tag.locals.page = found 
     455      tag.expand 
    457456    end 
    458457  end 
     
    691690      File.join(request.relative_url_root, url) 
    692691    end 
     692     
     693    def absolute_path_for(base_path, new_path) 
     694      if new_path.first == '/' 
     695        new_path 
     696      else 
     697        File.expand_path(File.join(base_path, new_path)) 
     698      end 
     699    end 
     700     
     701    def page_found?(page) 
     702      page && !(FileNotFoundPage === page) 
     703    end 
    693704end 
  • trunk/radiant/public/javascripts/admin.js

    r759 r806  
    6060        $('publication-date').hide().select('select').invoke('disable'); 
    6161    }) 
     62  }); 
     63 
     64  when('notice', function(notice) { 
     65    new Effect.Fade(notice, {delay: 3}) 
    6266  }); 
    6367}); 
  • trunk/radiant/spec/models/standard_tags_spec.rb

    r782 r806  
    343343    page.should render(%{<r:find url="/parent/"><r:children:each><r:slug /> </r:children:each></r:find>}).as('child child-2 child-3 ') 
    344344  end 
     345  specify '<r:find> with relative url' do 
     346    page(:great_grandchild).should render(%{<r:find url="../../../child-2"><r:title/></r:find>}).as("Child 2") 
     347  end 
    345348   
    346349  specify '<r:escape_html>' do