设置作业总算大于2份是才显示开启匿评按钮

This commit is contained in:
sw 2014-11-05 14:51:21 +08:00
parent 6178919735
commit 09f89f23a1
2 changed files with 13 additions and 11 deletions

View File

@ -39,17 +39,19 @@
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
<% if (User.current.admin?||User.current.id==bid.author_id) %> <% if (User.current.admin?||User.current.id==bid.author_id)%>
<span id="<%=bid.id %>_anonymous_comment"> <% if bid.homeworks.count >= 2 %>
<% case bid.comment_status %> <span id="<%=bid.id %>_anonymous_comment">
<% when 0 %> <% case bid.comment_status %>
<%= link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n是否确定开启匿评", disable_with: '加载中...' %> <% when 0 %>
<% when 1 %> <%= link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n是否确定开启匿评", disable_with: '加载中...' %>
<%= link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评" %> <% when 1 %>
<% when 2 %> <%= link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评" %>
匿评结束 <% when 2 %>
匿评结束
<% end %>
</span>
<% end %> <% end %>
</span>
<%= link_to( <%= link_to(
l(:button_edit), l(:button_edit),
{:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id}, {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id},

View File

@ -103,7 +103,7 @@
<div class="inf_user_image"> <div class="inf_user_image">
<table> <table>
<% if (User.current.admin?||User.current.id==@bid.author_id) %> <% if (User.current.admin?||User.current.id==@bid.author_id) && bid.homeworks.count >= 2 %>
<tr> <tr>
<td valign="top" style="padding-left: 8px; font-size: 15px" colspan="2"> <td valign="top" style="padding-left: 8px; font-size: 15px" colspan="2">
<span id="<%=@bid.id %>_anonymous_comment"> <span id="<%=@bid.id %>_anonymous_comment">