summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-03-15 10:51:22 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-03-15 10:51:22 +0000
commite26ab0d4a251cc8fcd476a6140bccfcd24a9c446 (patch)
treeff241ea8d3fa68a09572ce776484d23274c002e8 /app/controllers
parentc5c335924b8e8b3f5f8a631f918d07416536c9fd (diff)
downloadredmine-e26ab0d4a251cc8fcd476a6140bccfcd24a9c446.tar.gz
redmine-e26ab0d4a251cc8fcd476a6140bccfcd24a9c446.zip
Show recent documents first (#29725).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@17972 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/documents_controller.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb
index e458d838a..fbd2b4136 100644
--- a/app/controllers/documents_controller.rb
+++ b/app/controllers/documents_controller.rb
@@ -33,7 +33,8 @@ class DocumentsController < ApplicationController
documents = @project.documents.includes(:attachments, :category).to_a
case @sort_by
when 'date'
- @grouped = documents.group_by {|d| d.updated_on.to_date }
+ documents.sort!{|a,b| b.updated_on <=> a.updated_on}
+ @grouped = documents.group_by {|d| d.updated_on.to_date}
when 'title'
@grouped = documents.group_by {|d| d.title.first.upcase}
when 'author'