1029 修复部分课程资源排序不可用问题

This commit is contained in:
chenmin 2014-08-05 12:00:39 +08:00
parent 226d19b912
commit 8b217735c3
1 changed files with 13 additions and 1 deletions

View File

@ -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