socialforge/app/views/exercise/_student_table.html.erb

74 lines
4.6 KiB
Plaintext

<% has_ob_qus = @exercise.exercise_questions.where(:question_type => [1, 2, 3]).count > 0 %>
<% has_su_qus = @exercise.exercise_questions.where(:question_type => 4).count > 0 %>
<table class="hwork-table-wrap" style="border-bottom:1px solid #eaeaea;">
<tr class="b_grey hworkH30">
<th class="hworkList40 pl5 pr5"><span class="c_dark f14 fb">序号</span></th>
<th class="hworkList50">&nbsp;&nbsp;</th>
<th class="hworkList130"><span class="c_dark f14 fb">姓名</span></th>
<th class="hworkList130"><span class="c_dark f14 fb">学号</span></th>
<th class="hworkList130"><span class="c_dark f14 fb">答题时间</span></th>
<th class="hworkList80"><%= has_ob_qus ? '客观题' : '' %></th>
<th class="hworkList80"><%= has_su_qus ? '主观题' : '' %></th>
<th class="hworkList80">
<%= link_to "成绩",'',:class => "c_dark f14 fb",:remote => true%>
</th>
</tr>
<% @exercise_users_list.each_with_index do |exercise, index|%>
<tr class="hworkListRow" id="student_work_<%= exercise.id%>" style="cursor:pointer;">
<td class="hworkList40 pl5 pr5" style="text-align:center; cursor: default;"><%=index + 1 %></td>
<td class="hworkPortrait float-none">
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;", :class => "mt15"),user_activities_path(exercise.user)) %>
</td>
<td class="hworkStName130 pr10 student_work_<%= exercise.id%>" title="姓名" id="student_name_<%= exercise.id%>">
<%=exercise.user.show_name %>
</td>
<td class="hworkStID130 pr10 student_work_<%= exercise.id%> float-none" title="学号" id="student_id_<%= exercise.id%>">
<span class="hidden fl" style="width:130px;"><%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%></span>
</td>
<td class="hworkList130 c_grey student_work_<%= exercise.id%>">
<% if exercise.commit_status == 0 %>
<span class="c_red">未答</span>
<% else %>
<% if exercise.created_at%>
<%= format_time(exercise.created_at) %>&nbsp;
<% end %>
<% end %>
</td>
<td class="hworkList80 <%= score_color exercise.objective_score %> student_work_<%= exercise.id%>">
<%= has_ob_qus ? (exercise.objective_score == -1 ? "0.0" : format("%.1f",exercise.objective_score)) : '' %>
</td>
<td class="hworkList80 <%= score_color(exercise.subjective_score == -1 ? nil : exercise.subjective_score) %> student_work_<%= exercise.id%>">
<%= has_su_qus ? (exercise.subjective_score == -1 ? "未批" : format("%.1f",exercise.subjective_score)) : ''%>
</td>
<td class="hworkList80 <%= score_color exercise.score%> student_final_scor_info student_work_<%= exercise.id%>">
<%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%>
</td>
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= exercise.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>
</tr>
<script type="text/javascript">
$(function(){
<% if (!@exercise.time.nil? && @exercise.time != -1) || Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
$(".student_work_<%= exercise.id%>").mouseenter(function(){
$("#work_click_<%= exercise.id%>").show();
}).mouseleave(function(){
$("#work_click_<%= exercise.id%>").hide();
}).mouse;
$(".student_work_<%= exercise.id%>").on('click',function() {
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user_id) %>';
});
<% else %>
//$("#show_student_result_div_<%#= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$(".student_work_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
//$("#student_id_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
//$("#student_class_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
<% end %>
});
/*function show_result(id) {
window.location.href = '<%#=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>';
}*/
</script>
<% end%>
</table>