1、匿评作品列表,得分显示为我的评分

2、匿评作品列表,不是我的作品用户名显示为匿名,学号不显示
This commit is contained in:
sw 2015-05-29 15:37:23 +08:00
parent 8522140182
commit a9235bef2f
6 changed files with 81 additions and 37 deletions

View File

@ -12,14 +12,13 @@ class StudentWorkController < ApplicationController
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
#当前列表为匿评列表
@is_evaluation = !@is_teacher && @homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2
if @show_all
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
else #学生
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
@stundet_works = @homework.student_works.where(:user_id => User.current.id)
elsif @homework.homework_detail_manual.comment_status == 2 #开启匿评,显示匿评作品和我的作品
elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品
@is_evaluation = true
my_work = @homework.student_works.where(:user_id => User.current.id)
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
end

View File

@ -0,0 +1,26 @@
<!-- 匿评作品列表,显示某一个作品的信息 -->
<ul class="hwork_ul <%= cycle("b_grey", "") %>" id="student_work_<%= student_work.id%>">
<% is_my_work = student_work.user == User.current%>
<li style="min-height: 1px;width: 65px;">
<% if is_my_work%>
<%= link_to student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id,user_path(student_work.user),:class => "c_blue02 hwork_center"%>
<% else%>
<%= link_to "--", "javascript:void(0)",:class => "c_blue02 hwork_center"%>
<% end%>
</li>
<li>
<% if is_my_work%>
<%= link_to student_work.user.show_name,user_path(student_work.user),:class => "c_blue02 hwork_name"%>
<% else%>
<%= link_to "匿名","javascript:void(0)",:class => "c_blue02 hwork_name"%>
<% end%>
</li>
<li class=" hwork_tit_e" style="width: 440px">
<%= link_to student_work.name, student_work_path(student_work),:remote => true%>
</li>
<li class=" hwork_code <%= student_work.teaching_asistant_score.nil? ? 'c_grey' : 'c_red'%>">
<% my_score = student_work_score(student_work,User.current) %>
<%= my_score.nil? ? "--" : format("%.2f",my_score.score)%>
</li>
<div class="cl"></div>
</ul><!---hwork_ul end-->

View File

@ -0,0 +1,12 @@
<li class="w70 ">
<span href="javascript:void(0);" class="c_dark f14 fb fl ml15 ">学号</span>
</li>
<li class="w70">
<span class="c_dark f14 fb fl ">学生姓名</span>
</li>
<li class="hwork_tit_e">
<span class="c_dark f14 fb fl">作品名称</span>
</li>
<li class="w70 mr5" >
<%= link_to "我的评分","javascript:void(0)",:class => "c_dark f14 fb fl"%>
</li>

View File

@ -0,0 +1,33 @@
<li class="w70 ">
<span href="javascript:void(0);" class="c_dark f14 fb fl ">学号</span>
</li>
<li class="w70">
<span class="c_dark f14 fb fl ">学生姓名</span>
</li>
<li class="hwork_tit">
<span class="c_dark f14 fb fl">作品名称</span>
</li>
<li class="w70 mr5" >
<%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
<% if @show_all && @order == "teacher_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%>
</li>
<li class="w70 mr5">
<%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
<% if @show_all && @order == "teaching_asistant_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%>
</li>
<li class="w60 mr5 ml10">
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
<% if @show_all && @order == "student_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%>
</li>
<li class="w40 ml10" id="final_sort">
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
<% if @show_all && @order == "final_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%>
</li>

View File

@ -53,44 +53,16 @@
<div class="cl"></div>
</div><!---code_list end--->
<ul class="hwork_ul">
<li class="w70 ">
<span href="javascript:void(0);" class="c_dark f14 fb fl ">学号</span>
</li>
<li class="w70">
<span class="c_dark f14 fb fl ">学生姓名</span>
</li>
<li class="hwork_tit">
<span class="c_dark f14 fb fl">作品名称</span>
</li>
<li class="w70 mr5" >
<%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
<% if @show_all && @order == "teacher_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%>
</li>
<li class="w70 mr5">
<%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
<% if @show_all && @order == "teaching_asistant_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%>
</li>
<li class="w60 mr5 ml10">
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
<% if @show_all && @order == "student_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%>
</li>
<li class="w40 ml10" id="final_sort">
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%>
<% if @show_all && @order == "final_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<% end%>
</li>
<% if @is_evaluation.nil?%>
<%= render :partial => 'student_work_title'%>
<% else%>
<%= render :partial => 'evaluation_work_title'%>
<% end%>
</ul><!---hwork_ul end-->
<div class="cl"></div>
<% @stundet_works.each do |student_work|%>
<%= render :partial => 'student_work',:locals => {:student_work => student_work}%>
<%= render :partial => (@is_evaluation ? 'evaluation_work' :'student_work'),:locals => {:student_work => student_work}%>
<div id="about_hwork_<%= student_work.id%>" ></div>
<% end%>

View File

@ -635,6 +635,8 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
.t_c{ text-align:center;}
.hwork_tit{ width:240px; float:left; }
.hwork_tit a{ width:255px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.hwork_tit_e{ width:440px; float:left; }
.hwork_tit_e a{ width:455px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.hwork_code{ width:60px; text-align:center; margin-right:15px;}
.hwork_code02{ width:60px; text-align:center; margin-right:10px;}
a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;overflow: hidden;}