From 8b217735c3f736709a6f54ba3b9fa81b43c01436 Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Tue, 5 Aug 2014 12:00:39 +0800 Subject: [PATCH] =?UTF-8?q?1029=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90=E6=8E=92=E5=BA=8F=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index a8ba3d426..a2d791017 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -40,7 +40,19 @@ class FilesController < ApplicationController render :layout => !request.xhr? elsif params[:course_id] @isproject = false - @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)] + @order = params[:sort].split(",")[0]; + @orderBy = @order.split(":")[0]; + @orderType = @order.split(":")[1]; + if @orderBy=="size" + @orderBy="filesize" + elsif @orderBy=="field_file_dense" + @orderBy="is_public" + elsif @orderBy=="attach_type" + @orderBy="attachtype" + elsif @orderBy=="content_type" + @orderBy="attachtype" + end + @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@orderBy} #{@orderType}").find(@course.id)] render :layout => 'base_courses' end end