学生查看作品列表时默认展开学生的作品信息

This commit is contained in:
cxt 2015-11-05 10:40:24 +08:00
parent 35c60c3253
commit 48cef54b9e
4 changed files with 46 additions and 38 deletions

View File

@ -3,21 +3,21 @@
<ul>
<li class="fl" >
<span class="tit_fb">上交时间:</span>
<%=format_time @work.created_at %>
<%=format_time work.created_at %>
</li>
<% if @work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %>
<% if work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %>
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
<li class="fr" >
<%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
<%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
</li>
<li class="fr" >
<%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%>
</li>
<% end%>
<% if @homework.homework_detail_manual.comment_status == 3 && @work.user != User.current%>
<% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%>
<!-- 匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= @work.id%>">
<li class="fr" id="student_work_praise_<%= work.id%>">
<%= render :partial => 'student_work_praise' %>
</li>
<% end%>
@ -26,7 +26,7 @@
<li >
<span class="tit_fb ">编程代码:</span>
<div class="showHworkP break_word">
<%= text_format(@work.description) if @work.description%>
<%= text_format(work.description) if work.description%>
</div>
<div class="cl"></div>
</li>
@ -37,10 +37,10 @@
测试结果:
</span>
<div class="show_hwork_p break_word">
<% @work.student_work_tests.each_with_index do |test, index| %>
<% work.student_work_tests.each_with_index do |test, index| %>
<div class="ProResultTop">
<p class="c_blue fl">
第<%= @work.student_work_tests.count - index%>次测试
第<%= work.student_work_tests.count - index%>次测试
</p>
<span class="fr c_grey">
<%= test.created_at.to_s(:db) %>
@ -79,24 +79,24 @@
<% end%>
<li >
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%>
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%>
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
</div>
<% end%>
<div class="cl"></div>
</li>
</ul>
<div class="ping_box fl" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%@student_work_scores.each do |score|%>
<div id="work_score_<%= score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => score,:is_last => score == @student_work_scores.last}%>
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%student_work_scores.each do |student_score|%>
<div id="work_score_<%= student_score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
</div>
<% end%>
</div>
<!---ping_box end--->
<a href="javascript:void(0);" class="fr linkBlue mt5 mb5" onclick="$('#about_hwork_<%= @work.id%>').html('');">收起</a>
<a href="javascript:void(0);" class="fr linkBlue mt5 mb5" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
<div class="cl"></div>
</div>

View File

@ -3,21 +3,21 @@
<ul>
<li class="fl" >
<span class="tit_fb">上交时间:</span>
<%=format_time @work.created_at %>
<%=format_time work.created_at %>
</li>
<% if @work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %>
<% if work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %>
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
<li class="fr" >
<%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
<%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
</li>
<li class="fr" >
<%= link_to "",edit_student_work_path(@work),:class => "pic_edit"%>
<%= link_to "",edit_student_work_path(work),:class => "pic_edit"%>
</li>
<% end%>
<% if @homework.homework_detail_manual.comment_status == 3 && @work.user != User.current%>
<% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%>
<!-- 匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= @work.id%>">
<li class="fr" id="student_work_praise_<%= work.id%>">
<%= render :partial => 'student_work_praise' %>
</li>
<% end%>
@ -25,50 +25,50 @@
<!--<li ><span class="tit_fb"> 参与人员:</span>程梦雯&nbsp;&nbsp;王强</li>-->
<% if @work.project%>
<% if work.project%>
<li >
<span class="tit_fb"> 关联项目:</span>
<%= link_to( @work.project.name, project_path(@work.project.id), :class => "linkBlue" )%>
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
</li>
<% end%>
<li >
<span class="tit_fb ">内容:</span>
<div class="showHworkP break_word">
<%= text_format(@work.description) if @work.description%>
<%= text_format(work.description) if work.description%>
</div>
<div class="cl"></div>
</li>
<li >
<span class="tit_fb"> 附件:</span>
<% if @work.attachments.empty?%>
<% if work.attachments.empty?%>
<span style="color: #999999">尚未提交附件</span>
<% else%>
<div class="fl" style="width: 90%;">
<%= render :partial => 'work_attachments_status', :locals => {:attachments => @work.attachments, :status => @homework.homework_detail_manual.comment_status} %>
<%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments, :status => @homework.homework_detail_manual.comment_status} %>
</div>
<% end%>
<div class="cl"></div>
</li>
<li >
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%>
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%>
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
</div>
<% end%>
<div class="cl"></div>
</li>
</ul>
<div class="ping_box fl" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%@student_work_scores.each do |score|%>
<div id="work_score_<%= score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => score,:is_last => score == @student_work_scores.last}%>
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%student_work_scores.each do |student_score|%>
<div id="work_score_<%= student_score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
</div>
<% end%>
</div>
<!---ping_box end--->
<a href="javascript:void(0);" class="fr linkBlue mt5 mb5" onclick="$('#about_hwork_<%= @work.id%>').html('');">收起</a>
<a href="javascript:void(0);" class="fr linkBlue mt5 mb5" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
<div class="cl"></div>
</div>

View File

@ -35,6 +35,14 @@
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work}%>
<% end%>
<div class="cl"></div>
<div id="about_hwork_<%= student_work.id%>"></div>
<div id="about_hwork_<%= student_work.id%>">
<% if student_work.user == User.current %>
<% if @homework.homework_type == 2%>
<%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
<% else %>
<%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
<% end %>
<% end %>
</div>
<div class="cl"></div>
<% end%>

View File

@ -3,9 +3,9 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0){
}
else{
<% if @homework.homework_type == 2%>
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show') %>");
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
<% else%>
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>");
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
<% end%>
$('#score_<%= @work.id%>').peSlider({range: 'min'});
}