Added a duplicate of the Redmine _membership partial but with 'hooks' for setting Rates. #1921

This commit is contained in:
Eric Davis
2009-01-20 15:38:29 -08:00
parent 6141554976
commit cfd6e09df5
+57
View File
@@ -0,0 +1,57 @@
<%# TODO: Override the default view until post 0.8.x which will have the hooks %>
<% if @memberships.any? %>
<table class="list memberships">
<thead>
<th><%= l(:label_project) %></th>
<th><%= l(:label_role) %></th>
<th style="width:15%"></th>
<%# TODO: Hook %>
<th><%= l(:rate_label_rate) %> <%= l(:rate_label_currency) %></td>
</thead>
<tbody>
<% @memberships.each do |membership| %>
<% next if membership.new_record? %>
<tr class="<%= cycle 'odd', 'even' %>">
<td><%=h membership.project %></td>
<td align="center">
<% form_tag({ :action => 'edit_membership', :id => @user, :membership_id => membership }) do %>
<%= select_tag 'membership[role_id]', options_from_collection_for_select(@roles, "id", "name", membership.role_id) %>
<%= submit_tag l(:button_change), :class => "small" %>
<% end %>
</td>
<td align="center">
<%= link_to l(:button_delete), {:action => 'destroy_membership', :id => @user, :membership_id => membership }, :method => :post, :class => 'icon icon-del' %>
</td>
<%# TODO: Hook %>
<td>
<% rate = Rate.for(@user, membership.project) %>
<% if rate.default? || rate.nil? %>
<% if rate.default? %>
<em><%= number_to_currency(rate.amount) %></em>
<% end %>
[ Set Rate Form ]
<% else %>
<strong><%= link_to number_to_currency(rate.amount), { :action => 'edit', :id => @user, :tab => 'rates'} %></strong>
<% end %>
</td>
</tr>
</tbody>
<% end; reset_cycle %>
</table>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<% if @projects.any? %>
<p>
<label><%=l(:label_project_new)%></label><br/>
<% form_tag({ :action => 'edit_membership', :id => @user }) do %>
<%= select_tag 'membership[project_id]', projects_options_for_select(@projects) %>
<%= l(:label_role) %>:
<%= select_tag 'membership[role_id]', options_from_collection_for_select(@roles, "id", "name") %>
<%= submit_tag l(:button_add) %>
<% end %>
</p>
<% end %>