RM_13612_members_roles_-_display_group_of_role_RM_V1.2.1.diff

RM V2.5+ - Jérôme BATAILLE, 2014-11-05 16:15

Download (1.85 KB)

View differences:

vendor/plugins/redmine_smile/app/views/projects/settings/_members.rhtml (copie de travail)
1 1
<%= error_messages_for 'member' %>
2 2
<% roles = Role.find_all_givable
3 3
  members = @project.member_principals.includes(:member_roles, :roles, :principal).all.sort %>
4 4

  
5 5
<div class="splitcontentleft">
6 6
<% if members.any? %>
......
14 14
     <%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
15 15
   </tr>
16 16
 </thead>
17 17
 <tbody>
18
<%
19
  group_member_role_by_id = {}
20
  members.each do |member|
21
    next if member.new_record?
22

  
23
    member.member_roles.each{|mr|
24
      next if mr.inherited_from.present?
25
      next if mr.member.principal.is_a?(::User)
26
      next if group_member_role_by_id[mr.id].present?
27
      group_member_role_by_id[mr.id] = mr
28
    }
29
  end
30
-%>
18 31
	<% members.each do |member| %>
19
	<% next if member.new_record? %>
32
	<% next if member.new_record?
33
      label_group = ''
34
      member.member_roles.each{|mr|
35
        if mr.inherited_from.present?
36
          next if group_member_role_by_id[mr.inherited_from].nil?
37
          label_group = " (#{group_member_role_by_id[mr.inherited_from].member.principal.lastname})"
38

  
39
          break
40
        end
41
      }
42
  %>
20 43
	<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
21
	<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td>
44
	<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %><%= label_group %></td>
22 45
  <td class="roles">
23 46
    <span id="member-<%= member.id %>-roles"><%=h member.roles.sort.collect(&:to_s).join(', ') %></span>