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