member_role_forms2.patch

Yuki Kita, 2010-05-11 14:38

Download (2.77 KB)

View differences:

app/views/projects/settings/_members.rhtml (working copy)
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);