Merge branch 'develop' into szzh

This commit is contained in:
sw 2015-06-25 14:25:35 +08:00
commit e4011adf16
3 changed files with 17 additions and 9 deletions

View File

@ -245,6 +245,9 @@ class StudentWorkController < ApplicationController
def student_work_absence_penalty
render_403 unless User.current.allowed_to?(:as_teacher,@course)
order = params[:order] || "desc"
if @homework.student_works.empty?
@stundet_works = []
else
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
@stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM(
SELECT * ,
@ -254,6 +257,7 @@ class StudentWorkController < ApplicationController
WHERE homework_common_id = #{@homework.id}
) AS table_1
ORDER BY absence #{order}")
end
@order = order == "desc" ? "asc" : "desc"
respond_to do |format|
format.html

View File

@ -36,7 +36,7 @@
<% 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);">
<a class="student_work_search fl" onclick="SearchByName_1($(this).prev(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a>
<%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher%>
<%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher && @homework.homework_type == 1 && @homework.homework_detail_manual.comment_status != 1 %>
<% end%>
<% if @is_teacher%>
<div class="fr">

View File

@ -863,6 +863,10 @@ function redo() {
window.location.reload()
}
function encodeHomeworkUrl(url){
var file = encodeURI(url).replace(/\+/g, '%2B');
return '/zipdown/download?file='+file;
}
//// 作业附件删除
$(function(){
@ -880,7 +884,7 @@ $(function(){
}
if(res.length==1){
location.href = '/zipdown/download?file='+res[0].file;return;
location.href = encodeHomeworkUrl(res[0].file);return;
}
document.getElementById('light').style.display='block';
@ -893,7 +897,7 @@ $(function(){
} else {
des = '第'+res[i].index+'个学生的作品下载';
}
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="/zipdown/download?file='+res[i].file+'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container);
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="'+ encodeHomeworkUrl(res[i].file) +'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container);
}
}
@ -910,7 +914,7 @@ $(function(){
else
{
if(res.length==1){
location.href = '/zipdown/download?file='+res[0].file;return;
location.href = encodeHomeworkUrl(res[0].file);return;
}
document.getElementById('light').style.display='block';
$container = $('#light .upload_box_ul');
@ -922,7 +926,7 @@ $(function(){
} else {
des = '第'+res[i].index+'个学生的作品下载';
}
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="/zipdown/download?file='+res[i].file+'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container);
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="'+ encodeHomeworkUrl(res[i].file) +'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container);
}
}