1.当作业文件列表为空时报403错提示改为alert提示

2.异常捕获代码后给出js提示:暂时不能下载此文件
This commit is contained in:
sw 2014-07-22 14:29:45 +08:00
parent 47ae398748
commit c2ff861fba
4 changed files with 5 additions and 3 deletions

View File

@ -43,7 +43,7 @@ class ZipdownController < ApplicationController
zipfile = zip_homework_by_user homework zipfile = zip_homework_by_user homework
send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile) send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile)
else else
render_403 :message => :no_file_dowmload render file: 'zipdown/no_file_dowmload.js.erb'
end end
else else
render_403 :message =>:notice_file_not_found render_403 :message =>:notice_file_not_found
@ -52,7 +52,7 @@ class ZipdownController < ApplicationController
render_403 :message => :notice_not_authorized render_403 :message => :notice_not_authorized
end end
rescue => e rescue => e
render file: 'public/file_not_found.html' render file: 'zipdown/file_not_fond.js.erb'
end end
private private

View File

@ -106,7 +106,7 @@
<td> <td>
<strong>提交文件:&nbsp; <strong>提交文件:&nbsp;
<% if is_evaluation || is_teacher%> <% 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 %> <% else %>
<span class="required">未开启互评功能作业不允许下载</span> <span class="required">未开启互评功能作业不允许下载</span>
<% end %> <% end %>

View File

@ -0,0 +1 @@
alert("对不起,这个文件暂时不能下载。 ");

View File

@ -0,0 +1 @@
alert('<%=l(:no_file_dowmload)%>');