@@ -39,14 +39,15 class ProjectsController < ApplicationController | |||||
39 |
|
39 | |||
40 | # Lists public projects |
|
40 | # Lists public projects | |
41 | def list |
|
41 | def list | |
42 |
sort_init |
|
42 | sort_init "#{Project.table_name}.name", "asc" | |
43 | sort_update |
|
43 | sort_update | |
44 | @project_count = Project.count(:all, :conditions => ["is_public=?", true]) |
|
44 | @project_count = Project.count(:all, :conditions => ["is_public=?", true]) | |
45 | @project_pages = Paginator.new self, @project_count, |
|
45 | @project_pages = Paginator.new self, @project_count, | |
46 | 15, |
|
46 | 15, | |
47 | params['page'] |
|
47 | params['page'] | |
48 | @projects = Project.find :all, :order => sort_clause, |
|
48 | @projects = Project.find :all, :order => sort_clause, | |
49 | :conditions => ["is_public=?", true], |
|
49 | :conditions => ["#{Project.table_name}.is_public=?", true], | |
|
50 | :include => :parent, | |||
50 | :limit => @project_pages.items_per_page, |
|
51 | :limit => @project_pages.items_per_page, | |
51 | :offset => @project_pages.current.offset |
|
52 | :offset => @project_pages.current.offset | |
52 |
|
53 |
@@ -2,15 +2,17 | |||||
2 |
|
2 | |||
3 | <table class="list"> |
|
3 | <table class="list"> | |
4 | <thead><tr> |
|
4 | <thead><tr> | |
5 |
<%= sort_header_tag( |
|
5 | <%= sort_header_tag("#{Project.table_name}.name", :caption => l(:label_project)) %> | |
6 | <th><%=l(:field_description)%></th> |
|
6 | <th><%=l(:field_description)%></th> | |
7 | <%= sort_header_tag('created_on', :caption => l(:field_created_on)) %> |
|
7 | <th><%=l(:field_parent)%></th> | |
|
8 | <%= sort_header_tag("#{Project.table_name}.created_on", :caption => l(:field_created_on)) %> | |||
8 | </tr></thead> |
|
9 | </tr></thead> | |
9 | <tbody> |
|
10 | <tbody> | |
10 | <% for project in @projects %> |
|
11 | <% for project in @projects %> | |
11 | <tr class="<%= cycle("odd", "even") %>"> |
|
12 | <tr class="<%= cycle("odd", "even") %>"> | |
12 | <td><%= link_to project.name, :action => 'show', :id => project %></td> |
|
13 | <td><%= link_to project.name, :action => 'show', :id => project %></td> | |
13 | <td><%=h project.description %></td> |
|
14 | <td><%=h project.description %></td> | |
|
15 | <td><%= link_to(project.parent.name, :action => 'show', :id => project.parent) unless project.parent.nil? %></td> | |||
14 | <td align="center"><%= format_date(project.created_on) %></td> |
|
16 | <td align="center"><%= format_date(project.created_on) %></td> | |
15 | </tr> |
|
17 | </tr> | |
16 | <% end %> |
|
18 | <% end %> |
@@ -9,6 +9,9 | |||||
9 | <ul> |
|
9 | <ul> | |
10 | <% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %> |
|
10 | <% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %> | |
11 | <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li> |
|
11 | <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li> | |
|
12 | <% unless @project.parent.nil? %> | |||
|
13 | <li><%=l(:field_parent)%>: <%= link_to @project.parent.name, :controller => 'projects', :action => 'show', :id => @project.parent %></li> | |||
|
14 | <% end %> | |||
12 | <% for custom_value in @custom_values %> |
|
15 | <% for custom_value in @custom_values %> | |
13 | <% if !custom_value.value.empty? %> |
|
16 | <% if !custom_value.value.empty? %> | |
14 | <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li> |
|
17 | <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li> |
General Comments 0
You need to be logged in to leave comments.
Login now