2009-05-10 14:54:31 +04:00
|
|
|
<% roles = Role.find_all_givable %>
|
|
|
|
<% projects = Project.active.find(:all, :order => 'lft') %>
|
|
|
|
|
|
|
|
<div class="splitcontentleft">
|
|
|
|
<% if @user.memberships.any? %>
|
2008-05-02 19:21:21 +04:00
|
|
|
<table class="list memberships">
|
|
|
|
<thead>
|
|
|
|
<th><%= l(:label_project) %></th>
|
2009-05-10 14:54:31 +04:00
|
|
|
<th><%= l(:label_role_plural) %></th>
|
2008-05-02 19:21:21 +04:00
|
|
|
<th style="width:15%"></th>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2009-05-10 14:54:31 +04:00
|
|
|
<% @user.memberships.each do |membership| %>
|
2008-05-02 19:21:21 +04:00
|
|
|
<% next if membership.new_record? %>
|
2009-05-10 14:54:31 +04:00
|
|
|
<tr id="member-<%= membership.id %>" class="<%= cycle 'odd', 'even' %> class">
|
|
|
|
<td class="project"><%=h membership.project %></td>
|
|
|
|
<td class="roles">
|
|
|
|
<span id="member-<%= membership.id %>-roles"><%=h membership.roles.sort.collect(&:to_s).join(', ') %></span>
|
|
|
|
<% remote_form_for(:membership, :url => { :action => 'edit_membership', :id => @user, :membership_id => membership },
|
|
|
|
:html => { :id => "member-#{membership.id}-roles-form", :style => 'display:none;'}) do %>
|
|
|
|
<p><% roles.each do |role| %>
|
|
|
|
<label><%= check_box_tag 'membership[role_ids][]', role.id, membership.roles.include?(role) %> <%=h role %></label><br />
|
|
|
|
<% end %></p>
|
|
|
|
<p><%= submit_tag l(:button_change) %>
|
|
|
|
<%= link_to_function l(:button_cancel), "$('member-#{membership.id}-roles').show(); $('member-#{membership.id}-roles-form').hide(); return false;" %></p>
|
2008-05-02 19:21:21 +04:00
|
|
|
<% end %>
|
2009-05-10 14:54:31 +04:00
|
|
|
</td>
|
|
|
|
<td class="buttons">
|
|
|
|
<%= link_to_function l(:button_edit), "$('member-#{membership.id}-roles').hide(); $('member-#{membership.id}-roles-form').show(); return false;", :class => 'icon icon-edit' %>
|
|
|
|
<%= link_to_remote l(:button_delete), { :url => { :controller => 'users', :action => 'destroy_membership', :id => @user, :membership_id => membership },
|
|
|
|
:method => :post },
|
|
|
|
:class => 'icon icon-del' %>
|
|
|
|
</td>
|
2008-05-02 19:21:21 +04:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
<% end; reset_cycle %>
|
|
|
|
</table>
|
|
|
|
<% else %>
|
|
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
2007-03-12 20:59:02 +03:00
|
|
|
<% end %>
|
2009-05-10 14:54:31 +04:00
|
|
|
</div>
|
2008-05-01 17:50:39 +04:00
|
|
|
|
2009-05-10 14:54:31 +04:00
|
|
|
<div class="splitcontentright">
|
|
|
|
<% if projects.any? %>
|
|
|
|
<fieldset><legend><%=l(:label_project_new)%></legend>
|
|
|
|
<% remote_form_for(:membership, :url => { :action => 'edit_membership', :id => @user }) do %>
|
|
|
|
<%= select_tag 'membership[project_id]', options_for_membership_project_select(@user, projects) %>
|
|
|
|
<p><%= l(:label_role_plural) %>:
|
|
|
|
<% roles.each do |role| %>
|
|
|
|
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%=h role %></label>
|
|
|
|
<% end %></p>
|
|
|
|
<p><%= submit_tag l(:button_add) %></p>
|
2007-03-12 20:59:02 +03:00
|
|
|
<% end %>
|
2009-05-10 14:54:31 +04:00
|
|
|
</fieldset>
|
2008-05-01 17:50:39 +04:00
|
|
|
<% end %>
|
2009-05-10 14:54:31 +04:00
|
|
|
</div>
|