From 78ac974a75bc662b56c83bcfad2ac7771e462141 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 4 Jun 2014 16:01:33 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=88=97=E8=A1=A8=E7=95=8C=E9=9D=A2=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=202.=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=94=A8=E6=88=B7=E5=9C=A8=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E4=B8=8B=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 2 +- app/views/bids/_bid_homework_show.html.erb | 8 +++++++- config/locales/zh.yml | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index b0c7e1861..054b3b5a3 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -159,7 +159,7 @@ module CoursesHelper end #获取当前用户在指定作业下提交的作业的集合 def cur_user_homework_for_bid bid - cur_user_homework = HomeworkAttach.where("user_id = ? and bid_id = ?",User.current,params[:id]) + cur_user_homework = HomeworkAttach.where("user_id = ? and bid_id = ?",User.current,bid.id) cur_user_homework end end diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 3ef55c567..c4eb875a1 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -15,7 +15,13 @@ <% if(User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)) %> <%# 提交作业按钮 %> - <%= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@project) %> + + <% cur_user_homework = cur_user_homework_for_bid(bid) %> + <% if cur_user_homework!= nil && cur_user_homework.count == 0 %> + <%= link_to l(:label_commit_homework),new_homework_attach_path(bid) %> + <% else %> + <%= l(:lable_has_commit_homework)%> + <% end %> <% end %> <% if (User.current.admin?||User.current.id==bid.author_id) %> <%= link_to( diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 9f6fb26c9..de390a8f8 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1277,6 +1277,7 @@ zh: label_current_contributors: 位当前贡献者 label_commit_limit: 作业提交时间已过! label_commit_ar: 作业提交截止时间快到了! + lable_has_commit_homework: 您已提交过作业 #modify by men label_x_current_contributors: zero: 位当前贡献者