Commit 92aae2749d961e8d7052f6471db81227f3d19691

Added popular projects box to home page
Fixed archives/project issue

Commit diff

app/controllers/articles_controller.rb

 
101101
102102 # Show all articles for a project
103103 def find_by_project
104 @articles = Article.find_by_project(@project.id, current_user)
105 if @articles.size > 0 then
106 @title = @project.title << " Articles"
107 @show_archive_breadcrumb = true
108 render :action => "ac_index"
104 if @project
105 @articles = Article.find_by_project(@project.id, current_user)
106 if @articles.size > 0
107 @title = @project.title << " Articles"
108 @show_archive_breadcrumb = true
109 render :action => "ac_index"
110 else
111 flash[:error] = "No articles found for project '" << @project.title << "'."
112 redirect_to project_path(@project)
113 end
109114 else
110 flash[:error] = "No articles found for project '" << @project.title << "'."
111 redirect_to project_path(@project)
115 flash[:error] = "Project not found."
116 redirect_to root_path
112117 end
113118 end
114119
toggle raw diff

app/helpers/articles_helper.rb

 
153153 out << %Q{#{link_to("Other", article_sitename_path)}}
154154 else
155155 #FIXME had to frig this until project routes merged
156 out << %Q{#{link_to(p, "/projects/" << u, :class => "blacklink")}}
156 out << %Q{#{link_to(p, "/archives/project/" << u, :class => "blacklink")}}
157157 end
158158 out << %Q{</th>}
159159 # numeric td
toggle raw diff

app/helpers/projects_helper.rb

 
3737 end
3838 out
3939 end
40
41 def render_right_popular_projects
42 out = ""
43 projects = Project.find_popular_projects(current_user)
44 if projects.size > 0
45 out << "<table class='right_default_table'>"
46 out << "<tr><th>Popular Projects</th></tr>"
47 for project in projects
48 #TODO only display admin/modify members
49 out << %Q{<tr><td>#{link_to(project.title, project_path(project))} </span></small></td></tr>}
50 end
51 out << "</table>"
52 end
53 out
54 end
4055
4156 def project_tab (active_tab, tab)
4257 title, suffix = Project.tab_settings(tab)
148148 end
149149 out
150150 end
151
152151
153152 def render_project_roadmap
154153 #get all milestones for a project
176176 out
177177 end
178178
179
180
181179 def format_life_cycle (ls)
182180 case ls
183181 when :pre_alpha
toggle raw diff

app/models/project.rb

 
175175 find(:all, :conditions => ["status = '#{:active}' AND ( audience = '#{:public}' OR id IN (" << projects_allowed << ") )"])
176176 end
177177
178 def self.find_popular_projects (curruser)
179 projects_allowed = Project.list_for_user(curruser)
180 find(:all, :conditions => ["status = '#{:active}' AND ( audience = '#{:public}' OR id IN (" << projects_allowed << ") )"], :limit => 10, :order => "views DESC")
181 end
182
178183 # returns all public projects (no private regardless of allowed)
179184 def self.find_all_active_public_projects (curruser)
180185 projects_allowed = Project.list_for_user(curruser)
toggle raw diff

app/views/site/ac_index.html.erb

 
66
77<%= div_rightcolumn_open %>
88<%= actionbox_basic %>
9<%= render_right_popular_projects %>
910<%= render_right_article_project_grid %>
1011<%= div_rightcolumn_close %>
1112
toggle raw diff

config/routes.rb

 
7979 #FIXME this can probably be converted in to a map.resources :archives, has_many => [categories, types, projects]
8080 map.article_category 'archives/category/:category', :controller => 'articles', :action => 'find_by_category'
8181 map.article_type 'archives/type/:article_type', :controller => 'articles', :action => 'find_by_type'
82 map.article_project 'archives/project/:project_slug', :controller => 'articles', :action => 'find_by_project'
82 map.article_project 'archives/project/:project_id', :controller => 'articles', :action => 'find_by_project'
8383 map.article_user 'archives/user/:user_slug', :controller => 'articles', :action => 'find_by_user'
8484 #although it could more issues with the security stuff
8585 #FIXME these need changing now
toggle raw diff

test/fixtures/wiki_pages/_gitlab_credits.txt

 
11Biggest credit is to Johan Sørensen of [Gitorious](http://www.gitorious.org), which
2this project is a fork of and Tom Preston-Werner who developed [Grit](http://grit.rubyforge.org) (the underlying interface to [Git](http://git.or.cz)).
2this project is a fork of and Tom Preston-Werner who developed [Grit](http://grit.rubyforge.org) (the interface to [Git](http://git.or.cz)).
33
44The credit list includes sources of code either directly used in the project, or read to help figure something out:
55
toggle raw diff