From b182feb988c670a5bf661035164775fbb2506c73 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 28 May 2015 10:47:40 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=85=A8=E9=83=A8=E9=99=84?=
=?UTF-8?q?=E4=BB=B6=E6=89=93=E5=8C=85=E4=B8=8B=E5=91=A8=E6=97=A0=E6=B3=95?=
=?UTF-8?q?=E4=B8=8B=E8=BD=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/index.html.erb | 2 +-
public/javascripts/application.js | 25 ++++++++++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 0309e2d72..42d85d480 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -42,7 +42,7 @@
<%= link_to "附件", "javascript:void(0)", class: "down_btn fr", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
<% else%>
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
- remote: true, class: "down_btn fr" %>
+ remote: true, class: "down_btn fr", :id => "download_homework_attachments" %>
<% end%>
列表
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 828be910d..d9100b0bb 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -897,8 +897,31 @@ $(function(){
}
}
+ });
+ $('#download_homework_attachments').bind('ajax:complete', function (event, data, status, xhr) {
+ if(status == 'success'){
+ var res = JSON.parse(data.responseText);
+ if(res.length<1){
+ return;
+ }
+ if(res.length==1){
+ location.href = '/zipdown/download?file='+res[0].file;return;
+ }
+ document.getElementById('light').style.display='block';
+ $container = $('#light .upload_box_ul');
+ $container.empty();
+ for(var i = 0; i 1){
+ des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载';
+ } else {
+ des = '第'+res[i].index+'个学生的作品下载';
+ }
+ $(''+(i+1)+'. '+des+' (共'+res[i].size+'M) ').appendTo($container);
- })
+ }
+ }
+ });
});