GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Gitorious aims to provide a great way of doing distributed opensource code collaboration.
Homepage: http://gitorious.org/projects/gitorious
Clone URL: git://github.com/dysinger/gitorious.git
Search controller and views
js (author)
Mon Mar 17 16:16:09 -0700 2008
commit  93ac4eb2e011e7a03f34219e06dc49f7c8762e7f
tree    fc8b633ed8976d3b605a1a0972a9bd8c3aa0734d
parent  882ce5c974804e6c8c6dce1de3cf61e94f62235c
...
4
5
6
 
 
 
 
7
8
 
...
4
5
6
7
8
9
10
11
12
13
0
@@ -4,5 +4,10 @@ coverage/*
0
 public/cache/*
0
 config/datbase.yml
0
 config/gitorious.yml
0
+config/ultrasphinx/development.conf
0
+config/ultrasphinx/test.conf
0
+config/ultrasphinx/production.conf
0
+config/ultrasphinx/staging.conf
0
 db/schema.rb
0
 .autotest
0
+db/sphinx/*
...
10
11
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
14
15
...
78
79
80
 
 
81
82
83
...
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
...
93
94
95
96
97
98
99
100
0
@@ -10,6 +10,21 @@ class Project < ActiveRecord::Base
0
   has_many :repository_clones, :conditions => ["mainline = ?", false],
0
     :class_name => "Repository"
0
     
0
+ is_indexed :fields => ["title", "description", "slug"],
0
+ :concatenate => [
0
+ { :class_name => 'Tag',
0
+ :field => 'name',
0
+ :as => 'category',
0
+ :association_sql => "LEFT OUTER JOIN taggings ON taggings.taggable_id = projects.id " +
0
+ "AND taggings.taggable_type = 'Project' LEFT OUTER JOIN tags ON taggings.tag_id = tags.id"
0
+ }],
0
+ :include => [{
0
+ :association_name => "user",
0
+ :field => "login",
0
+ :as => "user"
0
+ }]
0
+
0
+
0
   URL_FORMAT_RE = /^(http|https|nntp):\/\//.freeze
0
   validates_presence_of :title, :user_id, :slug
0
   validates_uniqueness_of :slug, :case_sensitive => false
0
@@ -78,6 +93,8 @@ class Project < ActiveRecord::Base
0
   
0
   def stripped_description
0
     description.gsub(/<\/?[^>]*>/, "")
0
+ # sanitizer = HTML::WhiteListSanitizer.new
0
+ # sanitizer.sanitize(description, :tags => %w(str), :attributes => %w(class))
0
   end
0
   
0
   protected
...
77
78
79
 
 
80
81
82
...
77
78
79
80
81
82
83
84
0
@@ -77,6 +77,8 @@ ActionController::Routing::Routes.draw do |map|
0
     end
0
   end
0
   
0
+ map.resource :search
0
+
0
   map.with_options :controller => 'sessions' do |session|
0
     session.login '/login', :action => 'new'
0
     session.logout '/logout', :action => 'destroy'
...
912
913
914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
915
916
...
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
0
@@ -912,4 +912,19 @@ ul.diff_stats small.deletions { color: #DC0000; }
0
 #repositories #branches {
0
   float: right;
0
   margin: 0 10px 10px 10px;
0
+}
0
+
0
+.search_results strong.highlight {
0
+ background: #ff0;
0
+ font-weight: normal;
0
+}
0
+.search_results strong {
0
+ font-weight: normal;
0
+}
0
+
0
+.search_results p, .search_results h3 {
0
+ margin-bottom: 5px;
0
+}
0
+.search_results .item {
0
+ margin-top: 20px;
0
 }
0
\ No newline at end of file
...
82
83
84
85
 
86
87
 
 
 
 
 
88
...
82
83
84
 
85
86
87
88
89
90
91
92
93
0
@@ -82,7 +82,12 @@ describe Project do
0
   
0
   it "should strip html tags" do
0
     project = create_project(:description => "<h1>Project A</h1>\n<b>Project A</b> is a....")
0
- project.stripped_description.index(/<\/?[^>]*>/).should == nil
0
+ project.stripped_description.should == "Project A\nProject A is a...."
0
   end
0
   
0
+ # it "should strip html tags, except highlights" do
0
+ # project = create_project(:description => %Q{<h1>Project A</h1>\n<strong class="highlight">Project A</strong> is a....})
0
+ # project.stripped_description.should == %Q(Project A\n<strong class="highlight">Project A</strong> is a....)
0
+ # end
0
+
0
 end

Comments

    No one has commented yet.