课程内姓名学号邮箱过滤,各种排序 改为js刷新页面

This commit is contained in:
sw 2015-09-22 15:52:08 +08:00
parent 2d48161928
commit 90536efa1e
6 changed files with 72 additions and 57 deletions

View File

@ -99,6 +99,7 @@ class StudentWorkController < ApplicationController
@score = @b_sort == "desc" ? "asc" : "desc"
respond_to do |format|
format.js
format.html
format.xls {
send_data(homework_to_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present",

View File

@ -6,46 +6,46 @@
</li>
<li class="hworkList130 hworkH30">
<%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50"%>
<%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50" ,:remote => true%>
<% if @show_all && @order == "created_at"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
<% end%>
</li>
<li class="hworkList50 hworkH30" >
<%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10"%>
<%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10" ,:remote => true%>
<% if @show_all && @order == "teacher_score"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
<% end%>
</li>
<li class="hworkList50 hworkH30">
<%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10"%>
<%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%>
<% if @show_all && @order == "teaching_asistant_score"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
<% end%>
</li>
<% if @homework.homework_type == 2%>
<li class="hworkList50 hworkH30">
<%= link_to "系统",@show_all ? student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10"%>
<%= link_to "系统",@show_all ? student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%>
<% if @show_all && @order == "system_score"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
<% end%>
</li>
<% end%>
<li class="hworkList50 hworkH30">
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10"%>
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%>
<% if @show_all && @order == "student_score"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
<% end%>
</li>
<li class="hworkList50 hworkH30">
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10"%>
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%>
<% if @show_all && @order == "score"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
<% end%>
</li>
</ul>

View File

@ -0,0 +1,36 @@
<div class="fl" style="border-bottom:1px solid #eaeaea; padding-bottom:10px; width:720px;">
<span class="c_dark f14 fb fl mr30">
作品
<font class="f12 c_red">
<%= @stundet_works.count%>
</font>
</span>
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%>
<div class="hworkSearchBox">
<input type="text" id="course_student_name" value="<%= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%= student_work_index_path(:homework => @homework.id)%>',event);"/>
<a class="hworkSearchIcon" onclick="SearchByName_1('<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
</div>
<%= select_tag(:late_penalty,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
<% end%>
</div>
<div class="cl"></div>
<div class="fl">
<% if @is_evaluation && !@stundet_works.empty?%>
<%= render :partial => "evaluation_title"%>
<% else%>
<%= render :partial => "evaluation_un_title"%>
<% end%>
</div>
<div class="cl"></div>
<% @stundet_works.each do |student_work|%>
<% if @is_evaluation%>
<%= render :partial => "evaluation_work", :locals => {:student_work => student_work}%>
<% else%>
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work}%>
<% end%>
<div class="cl"></div>
<div id="about_hwork_<%= student_work.id%>"></div>
<div class="cl"></div>
<% end%>

View File

@ -56,7 +56,7 @@
<a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="hworkMenu">
<li>
<%= link_to "导出作业成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'hworkExport postTypeGrey'%>
<%= link_to "导出作业成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>
</li>
<li>
<% if @homework.student_works.empty?%>
@ -85,43 +85,8 @@
<div class="hworkListContainer">
<div class="ctt2">
<div class="dis" id="tbc_01">
<div class="fl" style="border-bottom:1px solid #eaeaea; padding-bottom:10px; width:720px;">
<span class="c_dark f14 fb fl mr30">
作品
<font class="f12 c_red">
<%= @stundet_works.count%>
</font>
</span>
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%>
<div class="hworkSearchBox">
<input type="text" id="course_student_name" value="<%= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%= student_work_index_path(:homework => @homework.id)%>',event);"/>
<a class="hworkSearchIcon" onclick="SearchByName_1('<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
</div>
<%= select_tag(:late_penalty,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
<% end%>
</div>
<div class="cl"></div>
<div class="fl">
<% if @is_evaluation && !@stundet_works.empty?%>
<%= render :partial => "evaluation_title"%>
<% else%>
<%= render :partial => "evaluation_un_title"%>
<% end%>
</div>
<div class="cl"></div>
<% @stundet_works.each do |student_work|%>
<% if @is_evaluation%>
<%= render :partial => "evaluation_work", :locals => {:student_work => student_work}%>
<% else%>
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work}%>
<% end%>
<div class="cl"></div>
<div id="about_hwork_<%= student_work.id%>"></div>
<div class="cl"></div>
<% end%>
<div class="dis" id="homework_student_work_list">
<%= render :partial => "student_work/student_work_list"%>
</div>
</div>
</div>

View File

@ -0,0 +1,2 @@
$("#homework_student_work_list").html("<%= escape_javascript(render :partial => 'student_work/student_work_list') %>");
$("#export_student_work").replaceWith("<%= escape_javascript( link_to "导出作业成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => 'export_student_work') %>");

View File

@ -940,17 +940,28 @@ function SearchByName(url,event)
{
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13'){
location.href = url + "&name=" + $("#course_student_name").val() + "&group=" + $("#late_penalty").val();
$.get(
url,
{
name : $("#course_student_name").val(),
group : $("#late_penalty").val()
},
function (data) {
}
);
}
}
function SearchByName_1(url)
{
if($("#late_penalty").val() == null){
location.href = url + "&name=" + $("#course_student_name").val()
}
else{
location.href = url + "&name=" + $("#course_student_name").val() + "&group=" + $("#late_penalty").val();
}
$.get(
url,
{
name : $("#course_student_name").val(),
group : $("#late_penalty").val()
},
function (data) {
}
);
}
//新建作业临时弹框