|
|
@ -449,8 +449,6 @@ class FilesController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: 临时用 nyan
|
|
|
|
# TODO: 临时用 nyan
|
|
|
|
sort_init 'created_on', 'desc'
|
|
|
|
sort_init 'created_on', 'desc'
|
|
|
|
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
|
|
|
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
|
|
@ -459,13 +457,10 @@ class FilesController < ApplicationController
|
|
|
|
'downloads' => "#{Attachment.table_name}.downloads"
|
|
|
|
'downloads' => "#{Attachment.table_name}.downloads"
|
|
|
|
|
|
|
|
|
|
|
|
@containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
|
|
|
|
@containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
|
|
|
|
|
|
|
|
|
|
|
|
show_attachments @containers
|
|
|
|
show_attachments @containers
|
|
|
|
@tag_list = attachment_tag_list @all_attachments
|
|
|
|
@tag_list = attachment_tag_list @all_attachments
|
|
|
|
|
|
|
|
|
|
|
|
@attachtype = 0
|
|
|
|
@attachtype = 0
|
|
|
|
@contenttype = 0
|
|
|
|
@contenttype = 0
|
|
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.js
|
|
|
|
format.js
|
|
|
|
format.html {
|
|
|
|
format.html {
|
|
|
@ -763,21 +758,33 @@ class FilesController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
q = "%#{@q.strip}%"
|
|
|
|
q = "%#{@q.strip}%"
|
|
|
|
@result = find_course_attache q,@course,sort
|
|
|
|
if @project
|
|
|
|
|
|
|
|
@result = find_project_attache q, @project,sort
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
@result = find_course_attache q,@course,sort
|
|
|
|
|
|
|
|
end
|
|
|
|
@result = visable_attachemnts @result
|
|
|
|
@result = visable_attachemnts @result
|
|
|
|
if params[:other]
|
|
|
|
if params[:other]
|
|
|
|
@result = @result.select{|attachment|
|
|
|
|
if @project
|
|
|
|
!attachment.tag_list.include?('课件') &&
|
|
|
|
@result = @result.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
|
|
|
|
!attachment.tag_list.include?('软件') &&
|
|
|
|
else
|
|
|
|
!attachment.tag_list.include?('媒体') &&
|
|
|
|
@result = @result.select{|attachment|
|
|
|
|
!attachment.tag_list.include?('代码') &&
|
|
|
|
!attachment.tag_list.include?('课件') &&
|
|
|
|
!attachment.tag_list.include?('论文') }
|
|
|
|
!attachment.tag_list.include?('软件') &&
|
|
|
|
|
|
|
|
!attachment.tag_list.include?('媒体') &&
|
|
|
|
|
|
|
|
!attachment.tag_list.include?('代码') &&
|
|
|
|
|
|
|
|
!attachment.tag_list.include?('论文') }
|
|
|
|
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank?
|
|
|
|
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@searched_attach = paginateHelper @result,10
|
|
|
|
@searched_attach = paginateHelper @result,10
|
|
|
|
@tag_list = get_course_tag_list @course
|
|
|
|
if @project
|
|
|
|
|
|
|
|
@tag_list = get_project_tag_list @project
|
|
|
|
|
|
|
|
@result_search_project = @result
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
@tag_list = get_course_tag_list @course
|
|
|
|
|
|
|
|
end
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.js
|
|
|
|
format.js
|
|
|
|
# format.html
|
|
|
|
# format.html
|
|
|
|