diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-05 17:28:02 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-05 17:28:02 +0000 |
commit | 54ff294da164d9c8a0659610019f801ae4788068 (patch) | |
tree | 1a844a450847536b2303058332ef23a321f66ad3 /app/helpers/sort_helper.rb | |
parent | 80a60247f527825aa5e02e19bcaec4bd864fce2a (diff) | |
download | redmine-54ff294da164d9c8a0659610019f801ae4788068.tar.gz redmine-54ff294da164d9c8a0659610019f801ae4788068.zip |
More appropriate default sort order on sortable columns.
Sortable column added on issue subject (#580).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1121 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/sort_helper.rb')
-rw-r--r-- | app/helpers/sort_helper.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/helpers/sort_helper.rb b/app/helpers/sort_helper.rb index dfd681fff..155e7e5e3 100644 --- a/app/helpers/sort_helper.rb +++ b/app/helpers/sort_helper.rb @@ -92,7 +92,7 @@ module SortHelper # - The optional caption explicitly specifies the displayed link text. # - A sort icon image is positioned to the right of the sort link. # - def sort_link(column, caption=nil) + def sort_link(column, caption, default_order) key, order = session[@sort_name][:key], session[@sort_name][:order] if key == column if order.downcase == 'asc' @@ -104,11 +104,13 @@ module SortHelper end else icon = nil - order = 'desc' # changed for desc order by default + order = default_order end caption = titleize(Inflector::humanize(column)) unless caption - url = {:sort_key => column, :sort_order => order, :issue_id => params[:issue_id], :project_id => params[:project_id]} + url = {:sort_key => column, :sort_order => order, :status => params[:status], + :issue_id => params[:issue_id], + :project_id => params[:project_id]} link_to_remote(caption, {:update => "content", :url => url}, @@ -138,8 +140,9 @@ module SortHelper # def sort_header_tag(column, options = {}) caption = options.delete(:caption) || titleize(Inflector::humanize(column)) + default_order = options.delete(:default_order) || 'asc' options[:title]= l(:label_sort_by, "\"#{caption}\"") unless options[:title] - content_tag('th', sort_link(column, caption), options) + content_tag('th', sort_link(column, caption, default_order), options) end private |