diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index e6f20ea60..060ced940 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -143,16 +143,19 @@ module AttachmentsHelper params[:q] ||= "" filename_condition = params[:q].strip - attachAll = Attachment.scoped - - # 除去当前课程的所有资源 - nobelong_attach = Attachment.where("!(container_type = '#{course.class}' and container_id = #{course.id})") unless course.blank? + #attachAll = Attachment.where("author_id = #{User.current.id}") + # + ## 除去当前课程的所有资源 + #nobelong_attach = # 搜索域确定 - domain = course.nil? ? attachAll : nobelong_attach + course.nil? ? + domain=Attachment.where("author_id = #{User.current.id}") + : + domain=Attachment.where("author_id = #{User.current.id} and container_type = 'Course' and container_id <> #{course.id}") unless course.blank? # 搜索到的资源 - searched_attach = domain.where("is_public=1 and filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc') + searched_attach = domain.where("filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc') #searched_attach = private_filter searched_attach searched_attach = paginateHelper(searched_attach, 10) diff --git a/app/views/files/_course_new.html.erb b/app/views/files/_course_new.html.erb index 88c33d865..2eaa70cb6 100644 --- a/app/views/files/_course_new.html.erb +++ b/app/views/files/_course_new.html.erb @@ -1,4 +1,6 @@ -