diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 1e1934ecf..35e27a87f 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -26,14 +26,15 @@ class FilesController < ApplicationController include SortHelper def index - sort_init 'filename', 'asc' - sort_update 'filename' => "#{Attachment.table_name}.filename", - 'created_on' => "#{Attachment.table_name}.created_on", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" - - @containers = [ Project.includes(:attachments).reorder(sort_clause).find(@project.id)] - @containers += @project.versions.includes(:attachments).reorder(sort_clause).all.sort.reverse + #sort_init 'filename', 'asc' + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" + + @containers = [ Project.includes(:attachments).reorder("attachments.created_on DESC").find(@project.id)] #modify by Long Jun + @containers += @project.versions.includes(:attachments).reorder("created_on DESC").all.sort if @project.project_type == 1 render :layout => 'base_courses'