|
|
@ -42,17 +42,30 @@ class FilesController < ApplicationController
|
|
|
|
@isproject = false
|
|
|
|
@isproject = false
|
|
|
|
|
|
|
|
|
|
|
|
if params[:sort]
|
|
|
|
if params[:sort]
|
|
|
|
@oder = params[:sort].split(",")[0]
|
|
|
|
if params[:sort].include?":"
|
|
|
|
@order_by = @oder.split(":")[0]
|
|
|
|
@orderBy = params[:sort].split(":")[0];
|
|
|
|
@order_tyoe = @oder.split(":")[1]
|
|
|
|
@orderType = params[:sort].split(":")[1].split(",")[0];
|
|
|
|
if @order_by == "size"
|
|
|
|
else
|
|
|
|
@order_by = "filesize"
|
|
|
|
@orderBy = params[:sort].split(",")[0];
|
|
|
|
|
|
|
|
@orderType = "asc";
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@order_by} #{@order_tyoe}").find(@course.id)]
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if @orderBy
|
|
|
|
|
|
|
|
@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
|
|
|
|