[#809] Refactored a duplicate form to a partial.

This commit is contained in:
Eric Davis 2009-10-20 11:34:38 -07:00
parent f835420383
commit af00598e5e
3 changed files with 15 additions and 25 deletions

View File

@ -41,17 +41,5 @@
</div> </div>
<div class="splitcontentright"> <div class="splitcontentright">
<% if projects.any? %> <%= render :partial => 'members/membership_assignment', :locals => {:principal => @group, :projects => projects, :roles => roles } %>
<fieldset><legend><%=l(:label_project_new)%></legend>
<% remote_form_for(:membership, :url => { :action => 'edit_membership', :id => @group }) do %>
<%= label_tag "membership_project_id", l(:description_choose_project), :class => "hidden-for-sighted" %>
<%= select_tag 'membership[project_id]', options_for_membership_project_select(@group, 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>
<% end %>
</fieldset>
<% end %>
</div> </div>

View File

@ -0,0 +1,13 @@
<% if projects.any? %>
<fieldset><legend><%=l(:label_project_new)%></legend>
<% remote_form_for(:membership, :url => { :action => 'edit_membership', :id => principal }) do %>
<%= label_tag "membership_project_id", l(:description_choose_project), :class => "hidden-for-sighted" %>
<%= select_tag 'membership[project_id]', options_for_membership_project_select(principal, 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>
<% end %>
</fieldset>
<% end %>

View File

@ -47,16 +47,5 @@
</div> </div>
<div class="splitcontentright"> <div class="splitcontentright">
<% if projects.any? %> <%= render :partial => 'members/membership_assignment', :locals => {:principal => @user, :projects => projects, :roles => roles } %>
<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>
<% end %>
</fieldset>
<% end %>
</div> </div>