2007-05-05 19:21:18 +04:00
|
|
|
<%= error_messages_for 'member' %>
|
2007-08-29 20:52:35 +04:00
|
|
|
<% roles = Role.find_all_givable %>
|
2008-11-30 19:57:56 +03:00
|
|
|
<% users = User.active.find(:all).sort - @project.users %>
|
2007-09-22 17:17:49 +04:00
|
|
|
<% # members sorted by role position
|
2008-01-25 13:31:06 +03:00
|
|
|
members = @project.members.find(:all, :include => [:role, :user]).sort %>
|
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? %>
|
|
|
|
<tr class="<%= cycle 'odd', 'even' %>">
|
2007-06-29 21:27:27 +04:00
|
|
|
<td><%= 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 %>
|
2007-05-05 19:21:18 +04:00
|
|
|
|
2007-09-14 15:34:08 +04:00
|
|
|
<% if authorize_for('members', 'new') && !users.empty? %>
|
|
|
|
<% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post) do |f| %>
|
2007-05-05 19:35:28 +04:00
|
|
|
<p><label for="member_user_id"><%=l(:label_member_new)%></label><br />
|
2007-05-05 19:21:18 +04:00
|
|
|
<%= f.select :user_id, users.collect{|user| [user.name, user.id]} %>
|
|
|
|
<%= 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>
|
2007-05-05 19:21:18 +04:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|