member_role_forms.patch

Yuki Kita, 2010-05-08 02:53

Download (3.23 KB)

View differences:

app/views/projects/settings/_members.rhtml (working copy)
5 5
<div class="splitcontentleft">
6 6
<% if members.any? %>
7 7
<table class="list members">
8
	<thead>
8
	<thead><tr>
9 9
	  <th><%= l(:label_user) %> / <%= l(:label_group) %></th>
10 10
	  <th><%= l(:label_role_plural) %></th>
11 11
	  <th style="width:15%"></th>
12 12
          <%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
13
	</thead>
13
	</tr></thead>
14 14
	<tbody>
15 15
	<% members.each do |member| %>
16 16
	<% next if member.new_record? %>
......
19 19
  <td class="roles">
20 20
    <span id="member-<%= member.id %>-roles"><%=h member.roles.sort.collect(&:to_s).join(', ') %></span>
21 21
    <% if authorize_for('members', 'edit') %>
22
      <% remote_form_for(:member, member, :url => {:controller => 'members', :action => 'edit', :id => member},
22
      <% remote_form_for(:member, member, :url => {:controller => 'members', :action => 'edit', :id => member}, :complete => 'hideRoles();',
23 23
      																		:method => :post,
24 24
      																		:html => { :id => "member-#{member.id}-roles-form", :class => 'hol' }) do |f| %>
25 25
      	<p><% roles.each do |role| %>
......
36 36
      <%= link_to_function l(:button_edit), "$('member-#{member.id}-roles').hide(); $('member-#{member.id}-roles-form').show(); return false;", :class => 'icon icon-edit' %>
37 37
      <%= link_to_remote(l(:button_delete), { :url => {:controller => 'members', :action => 'destroy', :id => member},                                              
38 38
                                              :method => :post,
39
                                              :confirm => (!User.current.admin? && member.include?(User.current) ? l(:text_own_membership_delete_confirmation) : nil)
39
                                              :confirm => (!User.current.admin? && member.include?(User.current) ? l(:text_own_membership_delete_confirmation) : nil),
40
                                              :complete => 'hideRoles();'
40 41
                                            }, :title => l(:button_delete),
41 42
                                               :class => 'icon icon-del') if member.deletable? %>
42 43
  </td>
......
55 56

  
56 57
<div class="splitcontentright">
57 58
<% if roles.any? && principals.any? %>
58
  <% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post) do |f| %>
59
  <% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post, :complete => "hideRoles()") do |f| %>
59 60
    <fieldset><legend><%=l(:label_member_new)%></legend>
60 61
    
61 62
		<p><%= text_field_tag 'principal_search', nil %></p>
public/javascripts/application.js (working copy)
220 220
    }
221 221
});
222 222

  
223
Event.observe(window, 'load', function() {
223
function hideRoles() {
224 224
  $$('.hol').each(function(el) {
225 225
  	el.hide();
226 226
	});
227
});
227
}
228

  
229
Event.observe(window, 'load', hideRoles);