diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index 989ed776d..8913febd0 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -34,7 +34,8 @@ <%= link_to image_tag('delete.png'), {:controller => 'attachments', :action => 'delete_homework', :id => attachment.id}, :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, - :class => 'delete', + :class => 'delete delete-homework-icon', + :remote => true, :title => l(:button_delete) %> <% else %> <%= link_to image_tag('delete.png'), attachment_path(attachment), diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 2ca1a048b..9e9bc9859 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -850,3 +850,13 @@ function HS_setDate(inputObj){ function redo() { window.location.reload() } + + +//// 作业附件删除 +$(function(){ + $('.attachments a.delete-homework-icon').bind('ajax:complete', //this will work + function(event, data, status, xhr) { //note parametes + $(this).parent('p').remove(); + console.log("delete complete."); + }); +});