<% if projects.any? %>
<fieldset><legend><%=l(:label_project_new)%></legend>
<% remote_form_for(:membership, :url => { :action => 'edit_membership', :id => principal }) do %>
  <p><%= text_field_tag 'project_search', nil, :size => "40" %></p>
  <%= observe_field(:project_search,
                   :frequency => 0.5,
                   :update => :projects,
                   :url => { :controller => 'auto_completes', :action => 'projects', :id => principal },
                   :with => 'q')
  %>
		
  <div id="projects">
    <%= principals_check_box_tags 'project_ids[]', projects %>
  </div>

<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>
<% end %>
</fieldset>
<% end %>
