|
|
@ -40,9 +40,17 @@ class FilesController < ApplicationController
|
|
|
|
render :layout => !request.xhr?
|
|
|
|
render :layout => !request.xhr?
|
|
|
|
elsif params[:course_id]
|
|
|
|
elsif params[:course_id]
|
|
|
|
@isproject = false
|
|
|
|
@isproject = false
|
|
|
|
@order = params[:sort].split(",")[0];
|
|
|
|
|
|
|
|
@orderBy = @order.split(":")[0];
|
|
|
|
if params[:sort]
|
|
|
|
@orderType = @order.split(":")[1];
|
|
|
|
if params[:sort].include?":"
|
|
|
|
|
|
|
|
@orderBy = params[:sort].split(":")[0];
|
|
|
|
|
|
|
|
@orderType = params[:sort].split(":")[1].split(",")[0];
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
@orderBy = params[:sort].split(",")[0];
|
|
|
|
|
|
|
|
@orderType = "asc";
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if @orderBy=="size"
|
|
|
|
if @orderBy=="size"
|
|
|
|
@orderBy="filesize"
|
|
|
|
@orderBy="filesize"
|
|
|
|
elsif @orderBy=="field_file_dense"
|
|
|
|
elsif @orderBy=="field_file_dense"
|
|
|
@ -52,7 +60,12 @@ class FilesController < ApplicationController
|
|
|
|
elsif @orderBy=="content_type"
|
|
|
|
elsif @orderBy=="content_type"
|
|
|
|
@orderBy="attachtype"
|
|
|
|
@orderBy="attachtype"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if @orderBy
|
|
|
|
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@orderBy} #{@orderType}").find(@course.id)]
|
|
|
|
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@orderBy} #{@orderType}").find(@course.id)]
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)]
|
|
|
|
|
|
|
|
end
|
|
|
|
render :layout => 'base_courses'
|
|
|
|
render :layout => 'base_courses'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|