2007-05-05 19:21:18 +04:00
|
|
|
<%= error_messages_for 'member' %>
|
2009-03-28 15:07:05 +03:00
|
|
|
<% roles = Role.find_all_givable
|
2008-01-25 13:31:06 +03:00
|
|
|
members = @project.members.find(:all, :include => [:role, :user]).sort %>
|
2009-03-27 21:10:36 +03:00
|
|
|
|
|
|
|
<div class="splitcontentleft">
|
2007-09-22 17:17:49 +04:00
|
|
|
<% if members.any? %>
|
2007-05-05 19:21:18 +04:00
|
|
|
<table class="list">
|
|
|
|
<thead>
|
|
|
|
<th><%= l(:label_user) %></th>
|
|
|
|
<th><%= l(:label_role) %></th>
|
2007-05-05 19:35:28 +04:00
|
|
|
<th style="width:15%"></th>
|
2008-09-10 05:49:51 +04:00
|
|
|
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
|
2007-05-05 19:21:18 +04:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2007-09-22 17:17:49 +04:00
|
|
|
<% members.each do |member| %>
|
2007-05-05 19:21:18 +04:00
|
|
|
<% next if member.new_record? %>
|
2009-03-27 21:10:36 +03:00
|
|
|
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %>">
|
2009-03-27 21:27:06 +03:00
|
|
|
<td><%=h member.name %></td>
|
2007-05-05 19:21:18 +04:00
|
|
|
<td align="center">
|
|
|
|
<% if authorize_for('members', 'edit') %>
|
|
|
|
<% remote_form_for(:member, member, :url => {:controller => 'members', :action => 'edit', :id => member}, :method => :post) do |f| %>
|
|
|
|
<%= f.select :role_id, roles.collect{|role| [role.name, role.id]}, {}, :class => "small" %>
|
|
|
|
<%= submit_tag l(:button_change), :class => "small" %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</td>
|
|
|
|
<td align="center">
|
2007-09-22 17:17:49 +04:00
|
|
|
<%= link_to_remote l(:button_delete), { :url => {:controller => 'members', :action => 'destroy', :id => member},
|
2007-05-05 19:21:18 +04:00
|
|
|
:method => :post
|
|
|
|
}, :title => l(:button_delete),
|
2007-09-22 17:17:49 +04:00
|
|
|
:class => 'icon icon-del' %>
|
2007-05-05 19:21:18 +04:00
|
|
|
</td>
|
2008-09-10 05:49:51 +04:00
|
|
|
<%= call_hook(:view_projects_settings_members_table_row, { :project => @project, :member => member}) %>
|
2007-05-05 19:21:18 +04:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
<% end; reset_cycle %>
|
|
|
|
</table>
|
2007-09-22 17:17:49 +04:00
|
|
|
<% else %>
|
|
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
|
|
<% end %>
|
2009-03-27 21:10:36 +03:00
|
|
|
</div>
|
2007-05-05 19:21:18 +04:00
|
|
|
|
2009-03-28 15:07:05 +03:00
|
|
|
|
|
|
|
<% users_count = User.active.count - @project.users.count
|
|
|
|
users = (users_count < 300) ? User.active.find(:all, :limit => 200).sort - @project.users : [] %>
|
|
|
|
|
2009-03-27 21:10:36 +03:00
|
|
|
<div class="splitcontentright">
|
2009-03-28 15:07:05 +03:00
|
|
|
<% if roles.any? && users_count > 0 %>
|
2007-09-14 15:34:08 +04:00
|
|
|
<% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post) do |f| %>
|
2009-03-27 21:10:36 +03:00
|
|
|
<fieldset><legend><%=l(:label_member_new)%></legend>
|
2009-03-28 15:07:05 +03:00
|
|
|
<p><%= text_field_tag 'member[user_login]', nil, :size => "40" %></p>
|
|
|
|
<div id="member_user_login_choices" class="autocomplete">sqd</div>
|
|
|
|
<%= javascript_tag "new Ajax.Autocompleter('member_user_login', 'member_user_login_choices', '#{ url_for(:controller => 'members', :action => 'autocomplete_for_member_login', :id => @project) }', { minChars: 1, frequency: 0.5, paramName: 'user' });" %>
|
|
|
|
<% unless users.empty? %>
|
|
|
|
<div>
|
|
|
|
<% users.each do |user| -%>
|
|
|
|
<label><%= check_box_tag 'member[user_ids][]', user.id, false %> <%= user %></label>
|
|
|
|
<% end -%>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2009-03-27 21:10:36 +03:00
|
|
|
<p><%= l(:label_role) %>: <%= f.select :role_id, roles.collect{|role| [role.name, role.id]}, :selected => nil %>
|
2007-05-05 19:35:28 +04:00
|
|
|
<%= submit_tag l(:button_add) %></p>
|
2009-03-27 21:10:36 +03:00
|
|
|
</fieldset>
|
2007-05-05 19:21:18 +04:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2009-03-27 21:10:36 +03:00
|
|
|
</div>
|