Move the project member list rendering to an helper.
git-svn-id: http://redmine.rubyforge.org/svn/branches/work@1380 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -86,7 +86,6 @@ class ProjectsController < ApplicationController
|
|||||||
# Show @project
|
# Show @project
|
||||||
def show
|
def show
|
||||||
@custom_values = @project.custom_values.find(:all, :include => :custom_field, :order => "#{CustomField.table_name}.position")
|
@custom_values = @project.custom_values.find(:all, :include => :custom_field, :order => "#{CustomField.table_name}.position")
|
||||||
@members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
|
|
||||||
@subprojects = @project.active_children
|
@subprojects = @project.active_children
|
||||||
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
|
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
|
||||||
@trackers = @project.rolled_up_trackers
|
@trackers = @project.rolled_up_trackers
|
||||||
|
|||||||
@@ -29,6 +29,16 @@ module ProjectsHelper
|
|||||||
h(truncate(text, 250))
|
h(truncate(text, 250))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Renders the member list displayed on project overview
|
||||||
|
def render_member_list(project)
|
||||||
|
members_by_role = project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
|
||||||
|
if members_by_role.any?
|
||||||
|
title = content_tag('h3', l(:label_member_plural), :class => 'icon22 icon22-users')
|
||||||
|
content = members_by_role.keys.sort.collect { |role| "#{role.name}: " + members_by_role[role].collect(&:user).sort.collect{|u| link_to_user u}.join(", ") }.join('<br />')
|
||||||
|
content_tag('div', title + content, :class => 'box')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def project_settings_tabs
|
def project_settings_tabs
|
||||||
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural},
|
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural},
|
||||||
{:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural},
|
{:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural},
|
||||||
|
|||||||
@@ -35,16 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="splitcontentright">
|
<div class="splitcontentright">
|
||||||
<% if @members_by_role.any? %>
|
<%= render_member_list(@project) %>
|
||||||
<div class="box">
|
|
||||||
<h3 class="icon22 icon22-users"><%=l(:label_member_plural)%></h3>
|
|
||||||
<p><% @members_by_role.keys.sort.each do |role| %>
|
|
||||||
<%= role.name %>:
|
|
||||||
<%= @members_by_role[role].collect(&:user).sort.collect{|u| link_to_user u}.join(", ") %>
|
|
||||||
<br />
|
|
||||||
<% end %></p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @news.any? && authorize_for('news', 'index') %>
|
<% if @news.any? && authorize_for('news', 'index') %>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
|||||||
Reference in New Issue
Block a user