##// END OF EJS Templates
Main project list now displays root projects with their subprojects....
Jean-Philippe Lang -
r718:f2a058f8cf04
parent child
Show More
@@ -46,23 +46,15 class ProjectsController < ApplicationController
46 render :action => 'list' unless request.xhr?
46 render :action => 'list' unless request.xhr?
47 end
47 end
48
48
49 # Lists public projects
49 # Lists visible projects
50 def list
50 def list
51 sort_init "#{Project.table_name}.name", "asc"
51 projects = Project.find :all,
52 sort_update
52 :conditions => Project.visible_by(logged_in_user),
53 @project_count = Project.count(:all, :conditions => Project.visible_by(logged_in_user))
53 :include => :parent
54 @project_pages = Paginator.new self, @project_count,
54 @project_tree = projects.group_by {|p| p.parent || p}
55 15,
55 @project_tree.each_key {|p| @project_tree[p] -= [p]}
56 params['page']
57 @projects = Project.find :all, :order => sort_clause,
58 :conditions => Project.visible_by(logged_in_user),
59 :include => :parent,
60 :limit => @project_pages.items_per_page,
61 :offset => @project_pages.current.offset
62
63 render :action => "list", :layout => false if request.xhr?
64 end
56 end
65
57
66 # Add a new project
58 # Add a new project
67 def add
59 def add
68 @custom_fields = IssueCustomField.find(:all)
60 @custom_fields = IssueCustomField.find(:all)
@@ -60,7 +60,12 module IssuesHelper
60 label = content_tag('strong', label)
60 label = content_tag('strong', label)
61 old_value = content_tag("i", h(old_value)) if detail.old_value
61 old_value = content_tag("i", h(old_value)) if detail.old_value
62 old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?)
62 old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?)
63 value = content_tag("i", h(value)) if value
63 if detail.property == 'attachment' && !value.blank? && Attachment.find_by_id(detail.prop_key)
64 # Link to the attachment if it has not been removed
65 value = link_to(value, :controller => 'attachments', :action => 'download', :id => detail.prop_key)
66 else
67 value = content_tag("i", h(value)) if value
68 end
64 end
69 end
65
70
66 if !detail.value.blank?
71 if !detail.value.blank?
@@ -1,30 +1,21
1 <h2><%=l(:label_project_plural)%></h2>
1 <h2><%=l(:label_project_plural)%></h2>
2
2
3 <table class="list">
3 <dl class="projects">
4 <thead><tr>
4 <% @project_tree.keys.sort.each do |project| %>
5 <%= sort_header_tag("#{Project.table_name}.name", :caption => l(:label_project)) %>
5 <dt><%= link_to project.name, {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %>
6 <th><%=l(:field_parent)%></th>
6 <dd><%= textilizable(project.description, :project => project) %>
7 <%= sort_header_tag("#{Project.table_name}.created_on", :caption => l(:field_created_on)) %>
7
8 </tr></thead>
8 <% if @project_tree[project].any? %>
9 <tbody>
9 <%= l(:label_subproject_plural) %>:
10 <% for project in @projects %>
10 <%= @project_tree[project].sort.collect {|subproject|
11 <tr class="<%= cycle("odd", "even") %>">
11 link_to(subproject.name, {:action => 'show', :id => subproject}, :class => (User.current.member_of?(subproject) ? "icon icon-fav" : ""))}.join(', ') %>
12 <td>
12 <% end %>
13 <%= link_to project.name, {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %><br />
13 </dd></dt>
14 <%= textilizable project.description, :project => project %>
15 </td>
16 <td><%= link_to(project.parent.name, :action => 'show', :id => project.parent) unless project.parent.nil? %></td>
17 <td align="center"><%= format_date(project.created_on) %></td>
18 </tr>
19 <% end %>
14 <% end %>
20 </tbody>
15 </dl>
21 </table>
22
16
23 <% if User.current.logged? %>
17 <% if User.current.logged? %>
24 <div class="contextual">
18 <div class="contextual">
25 <span class="icon icon-fav"><%= l(:label_my_projects) %></span>
19 <span class="icon icon-fav"><%= l(:label_my_projects) %></span>
26 </div>
20 </div>
27 <% end %>
21 <% end %>
28
29 <%= pagination_links_full @project_pages %>
30 [ <%= @project_pages.current.first_item %> - <%= @project_pages.current.last_item %> / <%= @project_count %> ]
@@ -118,7 +118,6 background-repeat: no-repeat;
118 padding-left: 20px;
118 padding-left: 20px;
119 padding-top: 2px;
119 padding-top: 2px;
120 padding-bottom: 3px;
120 padding-bottom: 3px;
121 vertical-align: middle;
122 }
121 }
123
122
124 #navigation .icon {
123 #navigation .icon {
@@ -545,6 +544,9 font-size: 1em;
545 .task_todo { background:#aaa url(../images/task_todo.png); border: 1px solid #aaa; }
544 .task_todo { background:#aaa url(../images/task_todo.png); border: 1px solid #aaa; }
546 .milestone { background-image:url(../images/milestone.png); background-repeat: no-repeat; border: 0; }
545 .milestone { background-image:url(../images/milestone.png); background-repeat: no-repeat; border: 0; }
547
546
547 /***** project list *****/
548 dl.projects dt { font-size: 120%; margin-top:1.2em; padding: 2px 2px 4px 2px; background-color:#fafbfc; }
549
548 /***** Tooltips ******/
550 /***** Tooltips ******/
549 .tooltip{position:relative;z-index:24;}
551 .tooltip{position:relative;z-index:24;}
550 .tooltip:hover{z-index:25;color:#000;}
552 .tooltip:hover{z-index:25;color:#000;}
General Comments 0
You need to be logged in to leave comments. Login now