Chris@909
|
1 <% roles = Role.find_all_givable %>
|
Chris@909
|
2 <% projects = Project.active.find(:all, :order => 'lft') %>
|
Chris@909
|
3
|
Chris@909
|
4 <div class="splitcontentleft">
|
Chris@909
|
5 <% if @group.memberships.any? %>
|
Chris@909
|
6 <table class="list memberships">
|
Chris@909
|
7 <thead><tr>
|
Chris@909
|
8 <th><%= l(:label_project) %></th>
|
Chris@909
|
9 <th><%= l(:label_role_plural) %></th>
|
Chris@909
|
10 <th style="width:15%"></th>
|
Chris@909
|
11 </tr></thead>
|
Chris@909
|
12 <tbody>
|
Chris@909
|
13 <% @group.memberships.each do |membership| %>
|
Chris@909
|
14 <% next if membership.new_record? %>
|
Chris@909
|
15 <tr id="member-<%= membership.id %>" class="<%= cycle 'odd', 'even' %> class">
|
Chris@909
|
16 <td class="project"><%=h membership.project %></td>
|
Chris@909
|
17 <td class="roles">
|
Chris@909
|
18 <span id="member-<%= membership.id %>-roles"><%=h membership.roles.sort.collect(&:to_s).join(', ') %></span>
|
Chris@909
|
19 <% remote_form_for(:membership, :url => { :action => 'edit_membership', :id => @group, :membership_id => membership },
|
Chris@909
|
20 :html => { :id => "member-#{membership.id}-roles-form", :style => 'display:none;'}) do %>
|
Chris@909
|
21 <p><% roles.each do |role| %>
|
Chris@909
|
22 <label><%= check_box_tag 'membership[role_ids][]', role.id, membership.roles.include?(role) %> <%=h role %></label><br />
|
Chris@909
|
23 <% end %></p>
|
Chris@909
|
24 <p><%= submit_tag l(:button_change) %>
|
Chris@909
|
25 <%= link_to_function l(:button_cancel), "$('member-#{membership.id}-roles').show(); $('member-#{membership.id}-roles-form').hide(); return false;" %></p>
|
Chris@909
|
26 <% end %>
|
Chris@909
|
27 </td>
|
Chris@909
|
28 <td class="buttons">
|
Chris@909
|
29 <%= link_to_function l(:button_edit), "$('member-#{membership.id}-roles').hide(); $('member-#{membership.id}-roles-form').show(); return false;", :class => 'icon icon-edit' %>
|
Chris@909
|
30 <%= link_to_remote l(:button_delete), { :url => { :controller => 'groups', :action => 'destroy_membership', :id => @group, :membership_id => membership },
|
Chris@909
|
31 :method => :post },
|
Chris@909
|
32 :class => 'icon icon-del' %>
|
Chris@909
|
33 </td>
|
Chris@909
|
34 </tr>
|
Chris@909
|
35 <% end; reset_cycle %>
|
Chris@909
|
36 </tbody>
|
Chris@909
|
37 </table>
|
Chris@909
|
38 <% else %>
|
Chris@909
|
39 <p class="nodata"><%= l(:label_no_data) %></p>
|
Chris@909
|
40 <% end %>
|
Chris@909
|
41 </div>
|
Chris@909
|
42
|
Chris@909
|
43 <div class="splitcontentright">
|
Chris@909
|
44 <% if projects.any? %>
|
Chris@909
|
45 <fieldset><legend><%=l(:label_project_new)%></legend>
|
Chris@909
|
46 <% remote_form_for(:membership, :url => { :action => 'edit_membership', :id => @group }) do %>
|
Chris@909
|
47 <%= label_tag "membership_project_id", l(:description_choose_project), :class => "hidden-for-sighted" %>
|
Chris@909
|
48 <%= select_tag 'membership[project_id]', options_for_membership_project_select(@group, projects) %>
|
Chris@909
|
49 <p><%= l(:label_role_plural) %>:
|
Chris@909
|
50 <% roles.each do |role| %>
|
Chris@909
|
51 <label><%= check_box_tag 'membership[role_ids][]', role.id %> <%=h role %></label>
|
Chris@909
|
52 <% end %></p>
|
Chris@909
|
53 <p><%= submit_tag l(:button_add) %></p>
|
Chris@909
|
54 <% end %>
|
Chris@909
|
55 </fieldset>
|
Chris@909
|
56 <% end %>
|
Chris@909
|
57 </div>
|