|
|
|
@ -134,6 +134,8 @@ class FilesController < ApplicationController
|
|
|
|
|
attribute = "created_on"
|
|
|
|
|
when "quotes"
|
|
|
|
|
attribute = "quotes"
|
|
|
|
|
else
|
|
|
|
|
attribute = "created_on"
|
|
|
|
|
end
|
|
|
|
|
@sort = order_by[0]
|
|
|
|
|
@order = order_by[1]
|
|
|
|
@ -148,15 +150,9 @@ class FilesController < ApplicationController
|
|
|
|
|
sort += ","
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
# if order_by.count == 1
|
|
|
|
|
# sort += "#{Attachment.table_name}.#{attribute} asc " if attribute
|
|
|
|
|
# elsif order_by.count == 2
|
|
|
|
|
# sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " if attribute && order_by[1]
|
|
|
|
|
# end
|
|
|
|
|
# if sort_type != params[:sort].split(",").last
|
|
|
|
|
# sort += ","
|
|
|
|
|
# end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
sort = "#{Attachment.table_name}.created_on desc"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@containers = [ Project.includes(:attachments).find(@project.id)]
|
|
|
|
@ -198,6 +194,8 @@ class FilesController < ApplicationController
|
|
|
|
|
attribute = "created_on"
|
|
|
|
|
when "quotes"
|
|
|
|
|
attribute = "quotes"
|
|
|
|
|
else
|
|
|
|
|
attribute = "created_on"
|
|
|
|
|
end
|
|
|
|
|
@sort = order_by[0]
|
|
|
|
|
@order = order_by[1]
|
|
|
|
@ -213,6 +211,8 @@ class FilesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
sort = "#{Attachment.table_name}.created_on desc"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
|
|
|
|
|