From e508cba95186d16cd528834f0e65e2a0af1d4717 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 14 Sep 2016 15:10:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B8=B8=E5=AE=A2=E8=BF=9B=E5=85=A5=E7=8F=AD?= =?UTF-8?q?=E7=BA=A7=EF=BC=8C=E8=B5=84=E6=BA=90=E5=87=BA=E7=8E=B0=E4=BA=86?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 4 +++- app/views/layouts/base_courses.html.erb | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index b3e946f95..8f0d10634 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -63,6 +63,7 @@ module CoursesHelper # searchTeacherAndAssistant(project).count end + # 统计数目 def show_nav?(count) count == 0 ? true : false end @@ -807,11 +808,12 @@ module CoursesHelper link.html_safe end + # 可以查看到资源库的资源 def visable_attachemnts_incourse course return[] unless course result = [] 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 end end diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 2c72e3e2e..84aa054e0 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -1,6 +1,7 @@ <%# 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)) %> <% homework_num = visable_course_homework @course %>