#994 作品下载:资源排序修正

This commit is contained in:
guange 2015-03-10 21:50:47 +08:00
parent 31351bc9e8
commit fd676f13b5
1 changed files with 8 additions and 3 deletions

View File

@ -143,12 +143,17 @@ class FilesController < ApplicationController
end
end
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
@containers += @project.versions.includes(:attachments).reorder(sort).all
@containers = [ Project.includes(:attachments).find(@project.id)]
@containers += @project.versions.includes(:attachments).all
ids = []
@containers.each do |c|
ids += c.attachments.pluck(:id)
end
@containers = [Struct.new(:attachments).new(Attachment.where('id in (?)',ids).reorder(sort))]
show_attachments @containers
respond_to do |format|
format.html
format.js