From 6698ff8169a7e000d435b6b39802c77f35ae6833 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 19 Jan 2009 10:28:58 -0800 Subject: [PATCH] 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 --- app/controllers/rates_controller.rb | 2 ++ app/views/rates/_list.html.erb | 31 ++++++++++++++++++++++++++++ app/views/rates/index.html.erb | 27 ++---------------------- app/views/users/_rates.html.erb | 32 +---------------------------- 4 files changed, 36 insertions(+), 56 deletions(-) create mode 100644 app/views/rates/_list.html.erb diff --git a/app/controllers/rates_controller.rb b/app/controllers/rates_controller.rb index 8fc06f6..a781cfc 100644 --- a/app/controllers/rates_controller.rb +++ b/app/controllers/rates_controller.rb @@ -1,4 +1,6 @@ class RatesController < ApplicationController + helper :users + # GET /rates # GET /rates.xml def index diff --git a/app/views/rates/_list.html.erb b/app/views/rates/_list.html.erb new file mode 100644 index 0000000..6a997fd --- /dev/null +++ b/app/views/rates/_list.html.erb @@ -0,0 +1,31 @@ + + + + + + + + + <% @rates.each do |rate| %> + + + + + + + +<% end; reset_cycle %> +
<%= l(:label_date) %><%= l(:label_project) %><%= l(:rate_label_rate) %>
<%= h format_date(rate.date_in_effect) %> + <%= link_to(h(rate.project), :controller => 'projects', :action => 'show', :id => rate.project) %> + <%= h rate.amount %> + <% 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 %> +
diff --git a/app/views/rates/index.html.erb b/app/views/rates/index.html.erb index 2de155f..8c664e4 100644 --- a/app/views/rates/index.html.erb +++ b/app/views/rates/index.html.erb @@ -1,26 +1,3 @@ -

Listing rates

+

<%= l(:rate_label_rate_history) %>

- - - - - - - - -<% for rate in @rates %> - - - - - - - - - -<% end %> -
AmountUserProjectDate in effect
<%=h rate.amount %><%=h rate.user_id %><%=h rate.project_id %><%=h rate.date_in_effect %><%= link_to 'Show', rate %><%= link_to 'Edit', edit_rate_path(rate) %><%= link_to 'Destroy', rate, :confirm => 'Are you sure?', :method => :delete %>
- -
- -<%= link_to 'New rate', new_rate_path %> +<%= render :partial => 'list' %> \ No newline at end of file diff --git a/app/views/users/_rates.html.erb b/app/views/users/_rates.html.erb index ffc10eb..5af545e 100644 --- a/app/views/users/_rates.html.erb +++ b/app/views/users/_rates.html.erb @@ -7,34 +7,4 @@ <%# Can't expect everyone to upgrade at the moment %> <% @rates = Rate.history_for_user(@user) %> - - - - - - - - - <% @rates.each do |rate| %> - - - - - - - -<% end; reset_cycle %> -
<%= l(:label_date) %><%= l(:label_project) %><%= l(:rate_label_rate) %>
<%= h format_date(rate.date_in_effect) %> - <%= link_to(h(rate.project), :controller => 'projects', :action => 'show', :id => rate.project) %> - <%= h rate.amount %> - <% 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 %> -
+<%= render :partial => 'rates/list' %>