diff app/helpers/sort_helper.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents cbb26bc654de
children 622f24f53b42
line wrap: on
line diff
--- a/app/helpers/sort_helper.rb	Wed Jun 27 14:54:18 2012 +0100
+++ b/app/helpers/sort_helper.rb	Mon Jan 07 12:01:42 2013 +0000
@@ -89,6 +89,10 @@
       sql.blank? ? nil : sql
     end
 
+    def to_a
+      @criteria.dup
+    end
+
     def add!(key, asc)
       @criteria.delete_if {|k,o| k == key}
       @criteria = [[key, asc]] + @criteria
@@ -160,7 +164,8 @@
   # sort_clause.
   # - criteria can be either an array or a hash of allowed keys
   #
-  def sort_update(criteria)
+  def sort_update(criteria, sort_name=nil)
+    sort_name ||= self.sort_name
     @sort_criteria = SortCriteria.new
     @sort_criteria.available_criteria = criteria
     @sort_criteria.from_param(params[:sort] || session[sort_name])
@@ -181,6 +186,10 @@
     @sort_criteria.to_sql
   end
 
+  def sort_criteria
+    @sort_criteria
+  end
+
   # Returns a link which sorts by the named column.
   #
   # - column is the name of an attribute in the sorted record collection.