Moved the Rate History out of the users partial and into a partial for Rates
* This will allow the RatesController to use the same view #1916
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
class RatesController < ApplicationController
|
||||
helper :users
|
||||
|
||||
# GET /rates
|
||||
# GET /rates.xml
|
||||
def index
|
||||
|
||||
31
app/views/rates/_list.html.erb
Normal file
31
app/views/rates/_list.html.erb
Normal file
@@ -0,0 +1,31 @@
|
||||
<table class="list">
|
||||
<thead>
|
||||
<th style="width:15%"><%= l(:label_date) %></th>
|
||||
<th><%= l(:label_project) %></th>
|
||||
<th style="width:15%"><%= l(:rate_label_rate) %></th>
|
||||
<th style="width:5%"></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @rates.each do |rate| %>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td><%= h format_date(rate.date_in_effect) %></td>
|
||||
<td>
|
||||
<%= link_to(h(rate.project), :controller => 'projects', :action => 'show', :id => rate.project) %>
|
||||
</td>
|
||||
<td align="right"><%= h rate.amount %></td>
|
||||
<td align="center">
|
||||
<% if rate.unlocked? %>
|
||||
<%= link_to image_tag('edit.png'),
|
||||
{:action => 'not_implemented', :id => @user, :rate_id => rate },
|
||||
{:method => :post } %>
|
||||
<%= link_to image_tag('delete.png'),
|
||||
{:action => 'not_implemented', :id => @user, :rate_id => rate },
|
||||
{:method => :post, :confirm => l(:text_are_you_sure) } %>
|
||||
<% else %>
|
||||
<%= image_tag('locked.png') %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<% end; reset_cycle %>
|
||||
</table>
|
||||
@@ -1,26 +1,3 @@
|
||||
<h1>Listing rates</h1>
|
||||
<h1><%= l(:rate_label_rate_history) %></h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Amount</th>
|
||||
<th>User</th>
|
||||
<th>Project</th>
|
||||
<th>Date in effect</th>
|
||||
</tr>
|
||||
|
||||
<% for rate in @rates %>
|
||||
<tr>
|
||||
<td><%=h rate.amount %></td>
|
||||
<td><%=h rate.user_id %></td>
|
||||
<td><%=h rate.project_id %></td>
|
||||
<td><%=h rate.date_in_effect %></td>
|
||||
<td><%= link_to 'Show', rate %></td>
|
||||
<td><%= link_to 'Edit', edit_rate_path(rate) %></td>
|
||||
<td><%= link_to 'Destroy', rate, :confirm => 'Are you sure?', :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New rate', new_rate_path %>
|
||||
<%= render :partial => 'list' %>
|
||||
@@ -7,34 +7,4 @@
|
||||
<%# Can't expect everyone to upgrade at the moment %>
|
||||
<% @rates = Rate.history_for_user(@user) %>
|
||||
|
||||
<table class="list">
|
||||
<thead>
|
||||
<th style="width:15%"><%= l(:label_date) %></th>
|
||||
<th><%= l(:label_project) %></th>
|
||||
<th style="width:15%"><%= l(:rate_label_rate) %></th>
|
||||
<th style="width:5%"></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @rates.each do |rate| %>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td><%= h format_date(rate.date_in_effect) %></td>
|
||||
<td>
|
||||
<%= link_to(h(rate.project), :controller => 'projects', :action => 'show', :id => rate.project) %>
|
||||
</td>
|
||||
<td align="right"><%= h rate.amount %></td>
|
||||
<td align="center">
|
||||
<% if rate.unlocked? %>
|
||||
<%= link_to image_tag('edit.png'),
|
||||
{:action => 'not_implemented', :id => @user, :rate_id => rate },
|
||||
{:method => :post } %>
|
||||
<%= link_to image_tag('delete.png'),
|
||||
{:action => 'not_implemented', :id => @user, :rate_id => rate },
|
||||
{:method => :post, :confirm => l(:text_are_you_sure) } %>
|
||||
<% else %>
|
||||
<%= image_tag('locked.png') %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<% end; reset_cycle %>
|
||||
</table>
|
||||
<%= render :partial => 'rates/list' %>
|
||||
|
||||
Reference in New Issue
Block a user