姓名排序
This commit is contained in:
parent
44a49af68b
commit
881854a2f0
|
@ -14,13 +14,21 @@ class StudentWorkController < ApplicationController
|
|||
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
|
||||
if @show_all
|
||||
if @homework.homework_type == 1 || @is_teacher || User.current.admin?
|
||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||
if @order == "name"
|
||||
@stundet_works = @homework.student_works.joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}")
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||
if @order == "name"
|
||||
@stundet_works = @homework.student_works.joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}")
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
end
|
||||
end
|
||||
else #学生
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
<span class="c_dark f14 fb fl">学号</span>
|
||||
</li>
|
||||
<li class=" hwork_name f14 fb c_dark">
|
||||
姓名
|
||||
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "name"%>
|
||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="hwork_tit">
|
||||
<span class="c_dark f14 fb fl">作品名称</span>
|
||||
|
|
Loading…
Reference in New Issue