1.游客进入班级,资源出现了两个入口

dev_shcool
daiao 9 years ago
parent 41ab10410f
commit e508cba951

@ -63,6 +63,7 @@ module CoursesHelper
# searchTeacherAndAssistant(project).count # searchTeacherAndAssistant(project).count
end end
# 统计数目
def show_nav?(count) def show_nav?(count)
count == 0 ? true : false count == 0 ? true : false
end end
@ -807,11 +808,12 @@ module CoursesHelper
link.html_safe link.html_safe
end end
# 可以查看到资源库的资源
def visable_attachemnts_incourse course def visable_attachemnts_incourse course
return[] unless course return[] unless course
result = [] result = []
course.attachments.each do |attachment| course.attachments.each do |attachment|
if (attachment.is_public? && attachment.is_publish == 1) ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,course)|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin? if attachment.is_public? && attachment.is_publish == 1 || User.current == attachment.author || User.current.allowed_to?(:as_teacher,course) || (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
result << attachment result << attachment
end end
end end

@ -1,6 +1,7 @@
<%# course_model %> <%# course_model %>
<%# course_file_num = visable_attachemnts_incourse(@course).count%> <%# course_file_num = Attachment.where(:container_type => "Course", :container_id => @course.id).count %>
<% course_file_num = Attachment.where(:container_type => "Course", :container_id => @course.id).count %>
<% course_file_num = visable_attachemnts_incourse(@course).count%>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% homework_num = visable_course_homework @course %> <% homework_num = visable_course_homework @course %>

Loading…
Cancel
Save