diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 051d601de..c4746ff29 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2946,32 +2946,34 @@ module ApplicationHelper #根据传入作业确定显示为提交作品、补交作品、查看作品等 def student_for_homework_common homework - if User.current.member_of_course?(homework.course) + if User.current.allowed_to?(:as_teacher, homework.course) + link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "查看作品", :target => '_blank' + else User.current.member_of_course?(homework.course) work = cur_user_works_for_homework homework project = cur_user_projects_for_homework homework if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1 - link_to "查看详情", homework_common_index_path(:course_id => homework.course_id), :class => 'hw_btn_green2 fr mt5',:title => '查看分组作业详情', :target => '_blank' + link_to "查看详情", homework_common_index_path(:course_id => homework.course_id), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank' else - link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green2 fr mt5', :target => '_blank' + link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank' end elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1 - link_to "查看详情", homework_common_index_path(:course_id => homework.course_id), :class => 'hw_btn_green2 fr mt5',:title => '查看分组作业详情', :target => '_blank' + link_to "查看详情", homework_common_index_path(:course_id => homework.course_id), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank' else link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'btn_orange_big fr mt5', :target => '_blank' end else if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前 - link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank' + link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank' elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 - link_to "查看作品",student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "匿评已结束", :target => '_blank' + link_to "查看作品",student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "匿评已结束", :target => '_blank' elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品 - link_to "修改作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green2 fr mt5', :target => '_blank' + link_to "修改作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank' elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id - link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'hw_btn_green2 fr mt5', :target => '_blank' + link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'hw_btn_green fr mt5', :target => '_blank' else - link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "作业截止后不可修改作品", :target => '_blank' + link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "作业截止后不可修改作品", :target => '_blank' end end end