|
|
|
@ -38,6 +38,17 @@ class FilesController < ApplicationController
|
|
|
|
|
@isproject = true
|
|
|
|
|
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
|
|
|
|
|
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
|
|
|
|
|
|
|
|
|
|
all_attachments = []
|
|
|
|
|
@containers.each do |container|
|
|
|
|
|
all_attachments += container.attachments
|
|
|
|
|
end
|
|
|
|
|
@limit = 10
|
|
|
|
|
@feedback_count = all_attachments.count
|
|
|
|
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
|
|
|
|
@offset ||= @feedback_pages.offset
|
|
|
|
|
@curse_attachments = all_attachments[@offset, @limit]
|
|
|
|
|
|
|
|
|
|
render :layout => !request.xhr?
|
|
|
|
|
elsif params[:course_id]
|
|
|
|
|
@isproject = false
|
|
|
|
@ -67,6 +78,18 @@ class FilesController < ApplicationController
|
|
|
|
|
else
|
|
|
|
|
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
all_attachments = []
|
|
|
|
|
@containers.each do |container|
|
|
|
|
|
all_attachments += container.attachments
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@limit = 10
|
|
|
|
|
@feedback_count = all_attachments.count
|
|
|
|
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
|
|
|
|
@offset ||= @feedback_pages.offset
|
|
|
|
|
@curse_attachments = all_attachments[@offset, @limit]
|
|
|
|
|
|
|
|
|
|
render :layout => 'base_courses'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|