From c2ff861fbaca5d6c879745da81d3fa042075abd3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 22 Jul 2014 14:29:45 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BD=93=E4=BD=9C=E4=B8=9A=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=BA=E7=A9=BA=E6=97=B6=E6=8A=A5403?= =?UTF-8?q?=E9=94=99=E6=8F=90=E7=A4=BA=E6=94=B9=E4=B8=BAalert=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=202.=E5=BC=82=E5=B8=B8=E6=8D=95=E8=8E=B7=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=90=8E=E7=BB=99=E5=87=BAjs=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=EF=BC=9A=E6=9A=82=E6=97=B6=E4=B8=8D=E8=83=BD=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=AD=A4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 4 ++-- app/views/bids/_homework_list.html.erb | 2 +- app/views/zipdown/file_not_fond.js.erb | 1 + app/views/zipdown/no_file_dowmload.js.erb | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 app/views/zipdown/file_not_fond.js.erb create mode 100644 app/views/zipdown/no_file_dowmload.js.erb diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 16e6ea870..9e1676474 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -43,7 +43,7 @@ class ZipdownController < ApplicationController zipfile = zip_homework_by_user homework send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile) else - render_403 :message => :no_file_dowmload + render file: 'zipdown/no_file_dowmload.js.erb' end else render_403 :message =>:notice_file_not_found @@ -52,7 +52,7 @@ class ZipdownController < ApplicationController render_403 :message => :notice_not_authorized end rescue => e - render file: 'public/file_not_found.html' + render file: 'zipdown/file_not_fond.js.erb' end private diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index b58f918df..2009d1252 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -106,7 +106,7 @@ 提交文件:  <% if is_evaluation || is_teacher%> - <%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework%> + <%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework, :remote => true%> <% else %> 未开启互评功能作业不允许下载 <% end %> diff --git a/app/views/zipdown/file_not_fond.js.erb b/app/views/zipdown/file_not_fond.js.erb new file mode 100644 index 000000000..28b6d886f --- /dev/null +++ b/app/views/zipdown/file_not_fond.js.erb @@ -0,0 +1 @@ +alert("对不起,这个文件暂时不能下载。 "); \ No newline at end of file diff --git a/app/views/zipdown/no_file_dowmload.js.erb b/app/views/zipdown/no_file_dowmload.js.erb new file mode 100644 index 000000000..372da5ac5 --- /dev/null +++ b/app/views/zipdown/no_file_dowmload.js.erb @@ -0,0 +1 @@ +alert('<%=l(:no_file_dowmload)%>'); \ No newline at end of file