parent
91b17ea91f
commit
d4b3afb54e
|
@ -11,7 +11,8 @@ class StudentWorkController < ApplicationController
|
||||||
@order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
|
@order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
|
||||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||||
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
|
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
|
||||||
if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
|
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
|
||||||
|
if @show_all
|
||||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||||
else #学生
|
else #学生
|
||||||
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
|
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
|
||||||
|
@ -120,8 +121,11 @@ class StudentWorkController < ApplicationController
|
||||||
|
|
||||||
#添加评分,已评分则为修改评分
|
#添加评分,已评分则为修改评分
|
||||||
def add_score
|
def add_score
|
||||||
@score = student_work_score @work,User.current
|
render_403 and return if User.current == @work.user #不可以匿评自己的作品
|
||||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||||
|
#老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分
|
||||||
|
render_403 and return unless @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2)
|
||||||
|
@score = student_work_score @work,User.current
|
||||||
if @score
|
if @score
|
||||||
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
|
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
|
||||||
@score.score = params[:score] if params[:score]
|
@score.score = params[:score] if params[:score]
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<span class="fl mt3">
|
<span class="fl mt3">
|
||||||
<%= link_to "所有作品(<span class='c_red'>#{@stundet_works.count}</span>)".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%>
|
<%= link_to "所有作品(<span class='c_red'>#{@stundet_works.count}</span>)".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%>
|
||||||
</span>
|
</span>
|
||||||
<% if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3%>
|
<% if @show_all%>
|
||||||
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
|
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
|
||||||
<% end%>
|
<% end%>
|
||||||
<% if @is_teacher%>
|
<% if @is_teacher%>
|
||||||
|
@ -63,26 +63,26 @@
|
||||||
<span class="c_dark f14 fb fl">作品名称</span>
|
<span class="c_dark f14 fb fl">作品名称</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="w70 mr5" >
|
<li class="w70 mr5" >
|
||||||
<%= link_to "教师评分",student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
|
<%= 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 @order == "teacher_score"%>
|
<% if @show_all && @order == "teacher_score"%>
|
||||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||||
<% end%>
|
<% end%>
|
||||||
</li>
|
</li>
|
||||||
<li class="w70 mr5">
|
<li class="w70 mr5">
|
||||||
<%= link_to "教辅评分",student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
|
<%= 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 @order == "teaching_asistant_score"%>
|
<% if @show_all && @order == "teaching_asistant_score"%>
|
||||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||||
<% end%>
|
<% end%>
|
||||||
</li>
|
</li>
|
||||||
<li class="w60 mr5 ml10">
|
<li class="w60 mr5 ml10">
|
||||||
<%= link_to "匿评",student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
|
<%= 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 @order == "student_score"%>
|
<% if @show_all && @order == "student_score"%>
|
||||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||||
<% end%>
|
<% end%>
|
||||||
</li>
|
</li>
|
||||||
<li class="w40 ml10" id="final_sort">
|
<li class="w40 ml10" id="final_sort">
|
||||||
<%= link_to "成绩",student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%>
|
<%= 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 @order == "final_score"%>
|
<% if @show_all && @order == "final_score"%>
|
||||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||||
<% end%>
|
<% end%>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in New Issue