课程、项目上传文件为空时给出提醒

This commit is contained in:
huang 2015-07-02 15:53:12 +08:00
parent 081a0cedf7
commit 5a950b227a
1 changed files with 13 additions and 4 deletions

View File

@ -25,7 +25,12 @@ $('#upload_file_div').slideToggle('slow');
closeModal(); closeModal();
$("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>'); $("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>');
// 添加文件上传成功提示, // 添加文件上传成功提示,
<% if params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash warning">您上传了一个空文件!</div>');
<% else %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>'); var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
<% end %>
$("#course_list").prepend(div); $("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000) setTimeout( function(){div.remove();},3000)
<%elsif @course%> <%elsif @course%>
@ -34,7 +39,11 @@ $('#upload_file_div').slideToggle('slow');
$("#courses_files_count_info").html("<%= @all_attachments.count%>"); $("#courses_files_count_info").html("<%= @all_attachments.count%>");
$("#courses_files_count_nav").html("(<%= @all_attachments.count%>)") $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)")
// 添加文件上传成功提示, // 添加文件上传成功提示,
<% if params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash warning">您上传了一个空文件!</div>');
<% else %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>'); var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
<% end %>
$("#course_list").prepend(div); $("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000) setTimeout( function(){div.remove();},3000)
<% end %> <% end %>