From f2a058f8cf043d42f0ba8a007d807032a84545b0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 14 Sep 2007 19:55:51 +0000 Subject: [PATCH] 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 --- app/controllers/projects_controller.rb | 22 ++++++----------- app/helpers/issues_helper.rb | 7 +++++- app/views/projects/list.rhtml | 33 ++++++++++---------------- public/stylesheets/application.css | 4 +++- 4 files changed, 28 insertions(+), 38 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 22d514f4d..710b6c188 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 756f142fa..8ef1de8f7 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -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? diff --git a/app/views/projects/list.rhtml b/app/views/projects/list.rhtml index 1fc3aab56..4474eef9f 100644 --- a/app/views/projects/list.rhtml +++ b/app/views/projects/list.rhtml @@ -1,30 +1,21 @@

<%=l(:label_project_plural)%>

- - - <%= sort_header_tag("#{Project.table_name}.name", :caption => l(:label_project)) %> - - <%= sort_header_tag("#{Project.table_name}.created_on", :caption => l(:field_created_on)) %> - - -<% for project in @projects %> - "> - - - - +
+<% @project_tree.keys.sort.each do |project| %> +
<%= link_to project.name, {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %> +
<%= 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 %> +
<% end %> -
-
<%=l(:field_parent)%>
- <%= link_to project.name, {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %>
- <%= textilizable project.description, :project => project %> -
<%= link_to(project.parent.name, :action => 'show', :id => project.parent) unless project.parent.nil? %><%= format_date(project.created_on) %>
+ <% if User.current.logged? %>
<%= l(:label_my_projects) %>
<% end %> - -<%= pagination_links_full @project_pages %> -[ <%= @project_pages.current.first_item %> - <%= @project_pages.current.last_item %> / <%= @project_count %> ] diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 5b3e70246..064ff5ec6 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -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;} -- 2.39.5