]> source.dussan.org Git - redmine.git/commitdiff
Main project list now displays root projects with their subprojects.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 14 Sep 2007 19:55:51 +0000 (19:55 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 14 Sep 2007 19:55:51 +0000 (19:55 +0000)
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

app/controllers/projects_controller.rb
app/helpers/issues_helper.rb
app/views/projects/list.rhtml
public/stylesheets/application.css

index 22d514f4d943ef9f22193a60b72b1a137e44c6ab..710b6c18855546da52856cfd9f7a644820f88bec 100644 (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)
index 756f142fa5b4c0dbf54d47fb62376c39c72e76fd..8ef1de8f77e29dc738209632db3d58f8631dae64 100644 (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?
index 1fc3aab569443edceeb4e7014a88f9db2cd2c09d..4474eef9fe1228cfa1fd83addeb6a618779fb3f6 100644 (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 %>
+</dd></dt>
 <% end %>
-  </tbody>
-</table>
+</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 %> ]
index 5b3e70246de737055642917f21ebdcfa47937711..064ff5ec6c1cf68d0f61ace953239a2a04925768 100644 (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;}