From 05dd3649f60c0efbe3c1853dc651483dc5c0b6e3 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 19 Jan 2009 15:00:43 -0800 Subject: [PATCH] Fixed the sorts by updated to 0.8 to use the new sort API and fixing the update element id. #1915 --- app/controllers/rates_controller.rb | 2 +- app/views/rates/_list.html.erb | 4 ++-- app/views/users/_rates.html.erb | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/controllers/rates_controller.rb b/app/controllers/rates_controller.rb index 255e269..f403342 100644 --- a/app/controllers/rates_controller.rb +++ b/app/controllers/rates_controller.rb @@ -11,7 +11,7 @@ class RatesController < ApplicationController # GET /rates.xml?user_id=1 def index sort_init "#{Rate.table_name}.date_in_effect", "desc" - sort_update # 'date_in_effect' => "#{Rate.table_name}.date_in_effect" + sort_update ['date_in_effect', 'project_id'] @rates = Rate.history_for_user(@user, sort_clause) diff --git a/app/views/rates/_list.html.erb b/app/views/rates/_list.html.erb index 16bf63a..c048686 100644 --- a/app/views/rates/_list.html.erb +++ b/app/views/rates/_list.html.erb @@ -5,13 +5,13 @@ :default_order => 'desc', :style => "width: 15%", :method => :get, - :update => "rate-history", + :update => "rate_history", :user_id => @user.id) %> <%= rate_sort_header_tag("project_id", :caption => l(:label_project), :default_order => 'asc', :method => :get, - :update => "rate-history", + :update => "rate_history", :user_id => @user.id) %> <%= l(:rate_label_rate) %> diff --git a/app/views/users/_rates.html.erb b/app/views/users/_rates.html.erb index 59841aa..ce6ec62 100644 --- a/app/views/users/_rates.html.erb +++ b/app/views/users/_rates.html.erb @@ -8,11 +8,10 @@

<%= l(:rate_label_rate_history) %>

<%# TODO: Refactor out of the view once there is a hook in the controller (Post 0.8.0). %> <%# Can't expect everyone to upgrade at the moment %> -<% sort_init "#{Rate.table_name}.date_in_effect", "desc" %> -<% sort_update # 'date_in_effect' => "#{Rate.table_name}.date_in_effect" %> - +<% sort_init "#{Rate.table_name}.date_in_effect", "desc" %> +<% sort_update ['date_in_effect', 'project_id'] %> <% @rates = Rate.history_for_user(@user, "#{Rate.table_name}.date_in_effect desc") %> <%= render :partial => 'rates/list' %> - \ No newline at end of file +