From e5e46819b427c4caac6501cb836335801962076c Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 10 Mar 2015 22:35:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?#867=20=E6=96=B0=E5=BB=BA=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=EF=BC=9A=E6=A0=A1=E9=AA=8C=E5=A4=B1=E8=B4=A5=E4=B9=9F=E8=A6=81?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 1d637919c..0949899dd 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -1,6 +1,6 @@ <% if defined?(container) && container && container.saved_attachments %> - <% container.attachments.each_with_index do |attachment, i| %> + <% container.saved_attachments.each_with_index do |attachment, i| %> <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> From 38c3b40ca1e6389dbc4118a5926b0e529938ac6a Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 11 Mar 2015 10:52:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?#1701=20=E4=BF=AE=E5=A4=8D=E5=9C=A8?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=BD=9C=E4=B8=9A=E6=97=B6=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=BC=9A=E5=AF=BC=E8=87=B4=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=86=85=E5=AE=B9=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_links.html.erb | 3 ++- public/javascripts/application.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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."); + }); +});