过滤之后现在所有的TAG云
This commit is contained in:
parent
a2b529b38b
commit
5649f4c5a1
|
@ -79,7 +79,8 @@ class FilesController < ApplicationController
|
|||
@result = find_course_attache q,@course,sort
|
||||
@result = visable_attachemnts @result
|
||||
@searched_attach = paginateHelper @result,10
|
||||
@tag_list = attachment_tag_list @result
|
||||
|
||||
@tag_list = get_course_tag_list @course
|
||||
end
|
||||
#rescue Exception => e
|
||||
# #render 'stores'
|
||||
|
@ -541,7 +542,7 @@ class FilesController < ApplicationController
|
|||
@result = visable_attachemnts @result
|
||||
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)}
|
||||
@searched_attach = paginateHelper @result,10
|
||||
@tag_list = attachment_tag_list @result
|
||||
@tag_list = get_course_tag_list @course
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -223,11 +223,7 @@ class TagsController < ApplicationController
|
|||
|
||||
if @obj && @object_flag == '6' && @obj.container.kind_of?(Course)
|
||||
@course = @obj.container
|
||||
all_attachments = @course.attachments.select{|attachment| attachment.is_public? ||
|
||||
(attachment.container_type == "Course" && User.current.member_of_course?(@course))||
|
||||
attachment.author_id == User.current.id
|
||||
}
|
||||
@tag_list = attachment_tag_list all_attachments
|
||||
@tag_list = get_course_tag_list @course
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
@ -274,11 +270,7 @@ class TagsController < ApplicationController
|
|||
end
|
||||
if @obj && @obj_flag == '6' && @obj.container.kind_of?(Course)
|
||||
@course = @obj.container
|
||||
all_attachments = @course.attachments.select{|attachment| attachment.is_public? ||
|
||||
(attachment.container_type == "Course" && User.current.member_of_course?(@course))||
|
||||
attachment.author_id == User.current.id
|
||||
}
|
||||
@tag_list = attachment_tag_list all_attachments
|
||||
@tag_list = @tag_list = get_course_tag_list @course
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -2106,4 +2106,14 @@ module ApplicationHelper
|
|||
end
|
||||
tag_list.sort {|a,b| b[1]<=>a[1]}
|
||||
end
|
||||
|
||||
#获取课程资源的TAG云
|
||||
def get_course_tag_list course
|
||||
all_attachments = course.attachments.select{|attachment| attachment.is_public? ||
|
||||
(attachment.container_type == "Course" && User.current.member_of_course?(course))||
|
||||
attachment.author_id == User.current.id
|
||||
}
|
||||
tag_list = attachment_tag_list all_attachments
|
||||
tag_list
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue