annotate .svn/pristine/0f/0fe8309158c952d8ecd963cac89b3329eaf84e52.svn-base @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents 261b3d9a4903
children
rev   line source
Chris@1464 1 <%= error_messages_for 'member' %>
Chris@1464 2 <% roles = Role.find_all_givable
Chris@1464 3 members = @project.member_principals.includes(:member_roles, :roles, :principal).all.sort %>
Chris@1464 4
Chris@1464 5 <div class="splitcontentleft">
Chris@1464 6 <% if members.any? %>
Chris@1464 7 <table class="list members">
Chris@1464 8 <thead><tr>
Chris@1464 9 <th><%= l(:label_user) %> / <%= l(:label_group) %></th>
Chris@1464 10 <th><%= l(:label_role_plural) %></th>
Chris@1464 11 <th style="width:15%"></th>
Chris@1464 12 <%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
Chris@1464 13 </tr></thead>
Chris@1464 14 <tbody>
Chris@1464 15 <% members.each do |member| %>
Chris@1464 16 <% next if member.new_record? %>
Chris@1464 17 <tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
Chris@1464 18 <td class="name <%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td>
Chris@1464 19 <td class="roles">
Chris@1464 20 <span id="member-<%= member.id %>-roles"><%= member.roles.sort.collect(&:to_s).join(', ') %></span>
Chris@1464 21 <%= form_for(member,
Chris@1464 22 {:as => :membership, :remote => true,
Chris@1464 23 :url => membership_path(member),
Chris@1464 24 :method => :put,
Chris@1464 25 :html => { :id => "member-#{member.id}-roles-form", :class => 'hol' }}
Chris@1464 26 ) do |f| %>
Chris@1464 27 <p>
Chris@1464 28 <% roles.each do |role| %>
Chris@1464 29 <label>
Chris@1464 30 <%= check_box_tag('membership[role_ids][]',
Chris@1464 31 role.id, member.roles.include?(role),
Chris@1464 32 :disabled => member.member_roles.detect {
Chris@1464 33 |mr| mr.role_id == role.id && !mr.inherited_from.nil?
Chris@1464 34 } ) %> <%= role %>
Chris@1464 35 </label><br />
Chris@1464 36 <% end %>
Chris@1464 37 </p>
Chris@1464 38 <%= hidden_field_tag 'membership[role_ids][]', '' %>
Chris@1464 39 <p>
Chris@1464 40 <%= submit_tag l(:button_save), :class => "small" %>
Chris@1464 41 <%= link_to_function(l(:button_cancel),
Chris@1464 42 "$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;") %>
Chris@1464 43 </p>
Chris@1464 44 <% end %>
Chris@1464 45 </td>
Chris@1464 46 <td class="buttons">
Chris@1464 47 <%= link_to_function l(:button_edit),
Chris@1464 48 "$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;",
Chris@1464 49 :class => 'icon icon-edit' %>
Chris@1464 50 <%= delete_link membership_path(member),
Chris@1464 51 :remote => true,
Chris@1464 52 :data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
Chris@1464 53 </td>
Chris@1464 54 <%= call_hook(:view_projects_settings_members_table_row, { :project => @project, :member => member}) %>
Chris@1464 55 </tr>
Chris@1464 56 <% end; reset_cycle %>
Chris@1464 57 </tbody>
Chris@1464 58 </table>
Chris@1464 59 <% else %>
Chris@1464 60 <p class="nodata"><%= l(:label_no_data) %></p>
Chris@1464 61 <% end %>
Chris@1464 62 </div>
Chris@1464 63
Chris@1464 64 <div class="splitcontentright">
Chris@1464 65 <% if roles.any? %>
Chris@1464 66 <%= form_for(@member,
Chris@1464 67 {:as => :membership, :url => project_memberships_path(@project),
Chris@1464 68 :remote => true, :method => :post}) do |f| %>
Chris@1464 69 <fieldset>
Chris@1464 70 <legend><%=l(:label_member_new)%></legend>
Chris@1464 71 <p>
Chris@1464 72 <%= label_tag("principal_search", l(:label_principal_search)) %>
Chris@1464 73 <%= text_field_tag('principal_search', nil) %>
Chris@1464 74 </p>
Chris@1464 75 <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
Chris@1464 76 <div id="principals_for_new_member">
Chris@1464 77 <%= render_principals_for_new_members(@project) %>
Chris@1464 78 </div>
Chris@1464 79 <p>
Chris@1464 80 <%= l(:label_role_plural) %>:
Chris@1464 81 <% roles.each do |role| %>
Chris@1464 82 <label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= role %></label>
Chris@1464 83 <% end %>
Chris@1464 84 </p>
Chris@1464 85 <p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
Chris@1464 86 </fieldset>
Chris@1464 87 <% end %>
Chris@1464 88 <% end %>
Chris@1464 89 </div>