Added parent project name (if it exists) on project list and project overview.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@404 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-04-02 20:17:02 +00:00
parent 3c8a38212e
commit 6e1b9326e4
3 changed files with 10 additions and 4 deletions

View File

@ -39,14 +39,15 @@ class ProjectsController < ApplicationController
# Lists public projects # Lists public projects
def list def list
sort_init 'name', 'asc' sort_init "#{Project.table_name}.name", "asc"
sort_update sort_update
@project_count = Project.count(:all, :conditions => ["is_public=?", true]) @project_count = Project.count(:all, :conditions => ["is_public=?", true])
@project_pages = Paginator.new self, @project_count, @project_pages = Paginator.new self, @project_count,
15, 15,
params['page'] params['page']
@projects = Project.find :all, :order => sort_clause, @projects = Project.find :all, :order => sort_clause,
:conditions => ["is_public=?", true], :conditions => ["#{Project.table_name}.is_public=?", true],
:include => :parent,
:limit => @project_pages.items_per_page, :limit => @project_pages.items_per_page,
:offset => @project_pages.current.offset :offset => @project_pages.current.offset

View File

@ -2,15 +2,17 @@
<table class="list"> <table class="list">
<thead><tr> <thead><tr>
<%= sort_header_tag('name', :caption => l(:label_project)) %> <%= sort_header_tag("#{Project.table_name}.name", :caption => l(:label_project)) %>
<th><%=l(:field_description)%></th> <th><%=l(:field_description)%></th>
<%= sort_header_tag('created_on', :caption => l(:field_created_on)) %> <th><%=l(:field_parent)%></th>
<%= sort_header_tag("#{Project.table_name}.created_on", :caption => l(:field_created_on)) %>
</tr></thead> </tr></thead>
<tbody> <tbody>
<% for project in @projects %> <% for project in @projects %>
<tr class="<%= cycle("odd", "even") %>"> <tr class="<%= cycle("odd", "even") %>">
<td><%= link_to project.name, :action => 'show', :id => project %></td> <td><%= link_to project.name, :action => 'show', :id => project %></td>
<td><%=h project.description %></td> <td><%=h project.description %></td>
<td><%= link_to(project.parent.name, :action => 'show', :id => project.parent) unless project.parent.nil? %></td>
<td align="center"><%= format_date(project.created_on) %></td> <td align="center"><%= format_date(project.created_on) %></td>
</tr> </tr>
<% end %> <% end %>

View File

@ -9,6 +9,9 @@
<ul> <ul>
<% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %> <% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>
<li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li> <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li>
<% unless @project.parent.nil? %>
<li><%=l(:field_parent)%>: <%= link_to @project.parent.name, :controller => 'projects', :action => 'show', :id => @project.parent %></li>
<% end %>
<% for custom_value in @custom_values %> <% for custom_value in @custom_values %>
<% if !custom_value.value.empty? %> <% if !custom_value.value.empty? %>
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li> <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>