member_list ,group by roles in course#show
This commit is contained in:
parent
9f8c764053
commit
369e5eccc0
|
@ -17,12 +17,18 @@ module CoursesHelper
|
|||
|
||||
# 根据角色查询
|
||||
def searchCountByRoles project, roles_id
|
||||
count = -1
|
||||
people = searchPeopleByRoles project, roles_id
|
||||
people.count
|
||||
end
|
||||
|
||||
# 根据角色查人
|
||||
def searchPeopleByRoles project, roles_id
|
||||
people = []
|
||||
begin
|
||||
count = project.members.joins(:member_roles).where("member_roles.role_id = :role_id", {:role_id => roles_id }).count
|
||||
people = project.members.joins(:member_roles).where("member_roles.role_id = :role_id", {:role_id => roles_id })
|
||||
rescue Exception => e
|
||||
logger.error "[CoursesHelper] ===> #{e}"
|
||||
end
|
||||
count
|
||||
people
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
</div>
|
||||
<div class="member_content">
|
||||
<%= error_messages_for 'member' %>
|
||||
<% roles = Role.find_all_givable
|
||||
members = @project.member_principals.includes(:roles, :principal).all.sort %>
|
||||
<% roles = Role.find_all_givable %>
|
||||
<% members = @project.member_principals.includes(:roles, :principal).all.sort %>
|
||||
<% members = searchPeopleByRoles(@project, 3).sort if params[:role] == '1' %>
|
||||
<% members = searchPeopleByRoles(@project, 5).sort if params[:role] == '2' %>
|
||||
<% if @project.project_type == 1 %>
|
||||
<%= render :partial => 'member_list', :locals => {:members => members} %>
|
||||
<% else %>
|
||||
|
|
|
@ -17,7 +17,13 @@
|
|||
<td>
|
||||
<table width="580px" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong> <%= h(e.project) if @project.nil? || @project.id != e.project.id %></strong><span class="font_lighter"> <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> <%= l(:label_new_activity) %> </span> <%= link_to format_activity_title(e.event_title), e.event_url %> </td>
|
||||
<td colspan="2" valign="top">
|
||||
<strong> <%= h(e.project) if @project.nil? || @project.id != e.project.id %></strong>
|
||||
<span class="font_lighter">
|
||||
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
|
||||
<%= l(:label_new_activity) %> </span>
|
||||
<%= link_to format_activity_title(e.event_title), e.event_url %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580px" >
|
||||
|
|
Loading…
Reference in New Issue