1.修改课程作业列表界面提交作业

2.修复获取当前用户在指定作业下提交作业方法不正确的问题
This commit is contained in:
sw 2014-06-04 16:01:33 +08:00
parent 94542e935a
commit 78ac974a75
3 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -15,7 +15,13 @@
<span style="float: right">
<% 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) %>
<!--<%= 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 %>
<span style="color: green; float: right"><%= l(:lable_has_commit_homework)%></span>
<% end %>
<% end %>
<% if (User.current.admin?||User.current.id==bid.author_id) %>
<%= link_to(

View File

@ -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: 位当前贡献者