Main project list now displays root projects with their subprojects.

Added files turned into links (if not removed) on the issue history.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@729 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-09-14 19:55:51 +00:00
parent 23264ec3eb
commit f2a058f8cf
4 changed files with 28 additions and 38 deletions

View File

@ -46,23 +46,15 @@ class ProjectsController < ApplicationController
render :action => 'list' unless request.xhr?
end
# Lists public projects
# Lists visible projects
def list
sort_init "#{Project.table_name}.name", "asc"
sort_update
@project_count = Project.count(:all, :conditions => Project.visible_by(logged_in_user))
@project_pages = Paginator.new self, @project_count,
15,
params['page']
@projects = Project.find :all, :order => sort_clause,
:conditions => Project.visible_by(logged_in_user),
:include => :parent,
:limit => @project_pages.items_per_page,
:offset => @project_pages.current.offset
render :action => "list", :layout => false if request.xhr?
projects = Project.find :all,
:conditions => Project.visible_by(logged_in_user),
:include => :parent
@project_tree = projects.group_by {|p| p.parent || p}
@project_tree.each_key {|p| @project_tree[p] -= [p]}
end
# Add a new project
def add
@custom_fields = IssueCustomField.find(:all)

View File

@ -60,7 +60,12 @@ module IssuesHelper
label = content_tag('strong', label)
old_value = content_tag("i", h(old_value)) if detail.old_value
old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?)
value = content_tag("i", h(value)) if value
if detail.property == 'attachment' && !value.blank? && Attachment.find_by_id(detail.prop_key)
# Link to the attachment if it has not been removed
value = link_to(value, :controller => 'attachments', :action => 'download', :id => detail.prop_key)
else
value = content_tag("i", h(value)) if value
end
end
if !detail.value.blank?

View File

@ -1,30 +1,21 @@
<h2><%=l(:label_project_plural)%></h2>
<table class="list">
<thead><tr>
<%= sort_header_tag("#{Project.table_name}.name", :caption => l(:label_project)) %>
<th><%=l(:field_parent)%></th>
<%= sort_header_tag("#{Project.table_name}.created_on", :caption => l(:field_created_on)) %>
</tr></thead>
<tbody>
<% for project in @projects %>
<tr class="<%= cycle("odd", "even") %>">
<td>
<%= link_to project.name, {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %><br />
<%= textilizable project.description, :project => project %>
</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>
</tr>
<dl class="projects">
<% @project_tree.keys.sort.each do |project| %>
<dt><%= link_to project.name, {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %>
<dd><%= textilizable(project.description, :project => project) %>
<% if @project_tree[project].any? %>
<%= l(:label_subproject_plural) %>:
<%= @project_tree[project].sort.collect {|subproject|
link_to(subproject.name, {:action => 'show', :id => subproject}, :class => (User.current.member_of?(subproject) ? "icon icon-fav" : ""))}.join(', ') %>
<% end %>
</tbody>
</table>
</dd></dt>
<% end %>
</dl>
<% if User.current.logged? %>
<div class="contextual">
<span class="icon icon-fav"><%= l(:label_my_projects) %></span>
</div>
<% end %>
<%= pagination_links_full @project_pages %>
[ <%= @project_pages.current.first_item %> - <%= @project_pages.current.last_item %> / <%= @project_count %> ]

View File

@ -118,7 +118,6 @@ background-repeat: no-repeat;
padding-left: 20px;
padding-top: 2px;
padding-bottom: 3px;
vertical-align: middle;
}
#navigation .icon {
@ -545,6 +544,9 @@ font-size: 1em;
.task_todo { background:#aaa url(../images/task_todo.png); border: 1px solid #aaa; }
.milestone { background-image:url(../images/milestone.png); background-repeat: no-repeat; border: 0; }
/***** project list *****/
dl.projects dt { font-size: 120%; margin-top:1.2em; padding: 2px 2px 4px 2px; background-color:#fafbfc; }
/***** Tooltips ******/
.tooltip{position:relative;z-index:24;}
.tooltip:hover{z-index:25;color:#000;}