1.修改课程实践列表提交作业按钮链接

2.增加提交作业的控制
3.修改获取在指定课程提交作业的集合的方法判断
This commit is contained in:
sw 2014-11-05 14:13:50 +08:00
parent 01350442fb
commit e5874283f1
4 changed files with 21 additions and 16 deletions

View File

@ -343,8 +343,7 @@ module CoursesHelper
end
#获取当前用户在指定作业下提交的作业的集合
def cur_user_homework_for_bid bid
cur_user_homework = HomeworkAttach.where("user_id = ? and bid_id = ?",User.current,bid.id)
cur_user_homework
bid.homeworks.where("user_id = ?",User.current)
end
#判断当前用户对指定作业是否已经评价过

View File

@ -23,10 +23,16 @@
<%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %>
</span>
<span style="float: right">
<% if(User.current.logged? && (!Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)) %>
<% if User.current.logged? && is_cur_course_student(@course) %>
<% 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) %>
<% if cur_user_homework!= nil && cur_user_homework.empty? %>
<% if bid.comment_status == 0 %>
<%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %>
<% else %>
<span title="只有开启匿评之前才能创建作业哦!">
<a style="color:#8e8e8e;">提交作业</a>
</span>
<% end %>
<% else %>
<span style="color: green; float: right">
<%= l(:lable_has_commit_homework)%>

View File

@ -79,7 +79,7 @@
<td style="vertical-align: top;font-size: 15px;">
<span style=" word-wrap: break-word; word-break: break-all">
<strong>
<%= link_to course.name.to_s, homework_course_path(course) if course %>
<%= link_to "返回课程主页", course_path(course) if course %>
</strong>
</span>
</td>

View File

@ -5,17 +5,17 @@
</div>
<!-- 上左下右 -->
<div class='desc_item'>
<span class=''>
<% unless course.is_public == 1 %>
<span class="private_project"><%= l(:label_private) %></span>
<% end %>
<%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
<span class=''>
<% unless course.is_public == 1 %>
<span class="private_project"><%= l(:label_private) %></span>
<% end %>
<%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
</span>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
</span>
</div>
<div class='desc_item text_nowrap'>
[<%= get_course_term course %>]