From e26ab0d4a251cc8fcd476a6140bccfcd24a9c446 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 15 Mar 2019 10:51:22 +0000 Subject: Show recent documents first (#29725). Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@17972 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/documents_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/controllers') 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' -- cgit v1.2.3