From 1126d9b9a9708bec5b3f4939e60768899d089e1b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 23 Mar 2015 18:06:53 +0800 Subject: [PATCH] =?UTF-8?q?#2082=20IE8=E6=B5=8F=E8=A7=88=E5=99=A8--?= =?UTF-8?q?=E4=BB=BB=E6=84=8F=E6=A8=A1=E5=9D=97=E4=B8=8A=E4=BC=A0=E9=99=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=9A=E4=B8=8A=E4=BC=A0=E9=99=84=E4=BB=B6=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E2=80=9C=E6=9C=AA=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E2=80=9D=E5=AD=97=E6=A0=B7=E5=B9=B6=E6=9C=AA=E9=9A=8F=E7=9D=80?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E7=9A=84=E4=B8=8A=E4=BC=A0=E5=8F=98=E6=88=90?= =?UTF-8?q?=E2=80=9C=E5=B7=B2=E4=B8=8A=E4=BC=A0X=E4=B8=AA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/attachments.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 8fbaa5981..bbaf18bb4 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -12,6 +12,17 @@ function postUpMsg(attachmentId) }) } + +function reload(fileSpan) { + fileSpan.remove(); + $('#upload_file_count').html("未上传文件"); + $old_file = $("#_file"); + $new_file = $old_file.clone(true); + $old_file.replaceWith($new_file); + $new_file.show(); + +} + function addFile(inputEl, file, eagerUpload) { if ($('#attachments_fields').children().length < 10) { @@ -25,7 +36,17 @@ function addFile(inputEl, file, eagerUpload) { $('', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload), $('公开:').attr({ 'class': 'ispublic-label' }) , $('', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload), - $(' ').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload), + $(' ').attr({ 'href': "#", 'class': 'remove-upload' }).click(function(){ + if(confirm('您确定要删除吗?')){ + removeFile(); + if(!eagerUpload){ + (function(e){ + reload(e); + })(fileSpan); + } + } + + }).toggle(!eagerUpload), $('