From c11905707d31b93abd194bca565ea2aa562ab8f3 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 15 Oct 2015 15:43:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E8=AF=BE=E7=A8=8B=E6=88=90=E5=91=98?= =?UTF-8?q?=20--=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81=E4=B8=AD=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=20=E6=8F=90=E4=BA=A4=20=EF=BC=8C=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E7=AD=89=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 27 +++++++++++++---------- app/views/users/_course_homework.html.erb | 10 +++++---- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 291e68d77..b18d0c706 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2349,22 +2349,25 @@ module ApplicationHelper #根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量 def user_for_homework_common homework,is_teacher - if is_teacher #老师显示作品数量 - link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" - else #学生显示提交作品、修改作品等按钮 - work = cur_user_works_for_homework homework - if work.nil? - link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' - else - if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前 - link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" - elsif homework.homework_type == 2 #编程作业不能修改作品 - link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' + if User.current.member_of_course?(homework.course) + if is_teacher #老师显示作品数量 + link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" + else #学生显示提交作品、修改作品等按钮 + work = cur_user_works_for_homework homework + if work.nil? + link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' else - link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue' + if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前 + link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" + elsif homework.homework_type == 2 #编程作业不能修改作品 + link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' + else + link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue' + end end end end + end def student_anonymous_comment homework diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 868f952fa..703a52c32 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -24,10 +24,12 @@ 匿评已结束 <% end%>
-
- <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %> - <%= user_for_homework_common activity,is_teacher %> -
+ <% if User.current.member_of_course?(activity.course) %> +
+ <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %> + <%= user_for_homework_common activity,is_teacher %> +
+ <% end %> <% if activity.homework_type == 2 && is_teacher%>