Project

General

Profile

Patch #13612 » RM_13612_members_roles_-_display_group_of_role_RM_V1.2.1.diff

Jérôme BATAILLE, 2013-03-27 14:30

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
   # Smile specific 2012 : #67860 Désactivation des rôles obsolètes lors de l'ajout d'un membre dans un projet
4
   roles_no_obsolete = Role.exclude_obsolete(roles, params[:debug_old_roles].present?)
5
   members = @project.member_principals.find(:all, :include => [:roles, :principal]).sort %>
3
  # Smile specific 2012 : #67860 Désactivation des rôles obsolètes lors de l'ajout d'un membre dans un projet
4
  roles_no_obsolete = Role.exclude_obsolete(roles, params[:debug_old_roles].present?)
5
  members = @project.member_principals.find(:all, :include => [:roles, :principal]).sort %>
6 6

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

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

  
38
          break
39
        end
40
      }
41
  %>
19 42
	<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
20
	<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td>
43
	<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %><%= label_group %></td>
21 44
  <td class="roles">
22 45
    <span id="member-<%= member.id %>-roles"><%=h member.roles.sort.collect(&:to_s).join(', ') %></span>
23 46
    <% if authorize_for('members', 'edit') %>
......
33 56
        																							 :disabled => member.member_roles.detect {|mr| mr.role_id == role.id && !mr.inherited_from.nil?} %> <%=h role %></label><br />
34 57
        <%
35 58
            end
59
            # END -- Smile specific 2012 : #67860 Désactivation des rôles obsolètes lors de l'ajout d'un membre dans un projet
36 60
          end
37
          # END -- Smile specific 2012 : #67860 Désactivation des rôles obsolètes lors de l'ajout d'un membre dans un projet
38 61
        %></p>
39 62
        <%= hidden_field_tag 'member[role_ids][]', '' %>
40 63
        <p><%= submit_tag l(:button_change), :class => "small" %>
(1-1/6)