Changeset 611

Show
Ignore:
Timestamp:
11/19/07 09:41:28 (10 months ago)
Author:
seancribbs
Message:

Rollback unclean changes to search.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/extensions/search/app/models/search_page.rb

    r610 r611  
    88  end 
    99 
    10 #  desc %{    <r:search:form [label="Search:"] /> 
    11 #    Renders a search form, with the optional label.} 
    12 #  tag 'search:form' do |tag| 
    13 #    label = tag.attr['label'].nil? ? "Search:" : tag.attr['label'] 
    14 #    content = %{<form action="#{self.url.chop}" method="get" id="search_form"><p><label for="q">#{label}</label> <input type="text" id="q" name="q" value="" size="15" /></p></form>} 
    15 #    content << "\n" 
    16 #  end 
     10  desc %{    <r:search:form [label="Search:"] /> 
     11    Renders a search form, with the optional label.} 
     12  tag 'search:form' do |tag| 
     13    label = tag.attr['label'].nil? ? "Search:" : tag.attr['label'] 
     14    content = %{<form action="#{self.url.chop}" method="get" id="search_form"><p><label for="q">#{label}</label> <input type="text" id="q" name="q" value="" size="15" /></p></form>} 
     15    content << "\n" 
     16  end 
    1717    
    1818  desc %{    Renders the passed query.} 
     
    6666    @query = "" 
    6767    q = @request.parameters[:q] 
    68     exclude_pages = (@request.parameters[:exclude_pages] || '').split(",") 
    6968    unless (@query = q.to_s.strip).blank? 
    7069      tokens = query.split.collect { |c| "%#{c.downcase}%"} 
     
    7271          :conditions => [(["((LOWER(content) LIKE ?) OR (LOWER(title) LIKE ?))"] * tokens.size).join(" AND "),  
    7372                         *tokens.collect { |token| [token] * 2 }.flatten]) 
    74       @query_result = pages.delete_if { |p| !p.published? ||  
    75         exclude_pages.include?(p.url) } 
     73      @query_result = pages.delete_if { |p| !p.published? } 
    7674    end 
    77      
    78     if @request.xhr? 
    79       if part :ajax_body 
    80         render_part :ajax_body   
    81       else 
    82         render_part :body 
    83       end 
     75    lazy_initialize_parser_and_context 
     76    if layout 
     77      parse_object(layout) 
    8478    else 
    85       super 
     79      render_page_part(:body) 
    8680    end 
    8781  end 
  • trunk/extensions/search/search_extension.rb

    r610 r611  
    66  
    77  def activate 
    8     Page.send :include, SearchTags 
    98    SearchPage 
    109  end 
  • trunk/extensions/search/test/functional/search_extension_test.rb

    r610 r611  
    1111   
    1212  def test_initialization 
    13     assert_equal File.join(File.expand_path(RAILS_ROOT), 'vendor', 'extensions', 'search'), SearchExtension.root 
     13    assert_equal RADIANT_ROOT + '/vendor/extensions/search', SearchExtension.root 
    1414    assert_equal 'Search', SearchExtension.extension_name 
    1515  end