From b06d462b532f9d43e49e348eb14e557d811c8ea2 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Tue, 1 Apr 2014 22:21:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=84=E4=BB=B6=E6=8C=89=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=20=20=E9=BE=99=E5=86=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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'