From d70ef4666b2df89a21bdfd0dbbb9ad4e3acba21b Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 29 Nov 2012 13:35:08 +0800 Subject: [PATCH] delete fixed.. --- app/views/desktop/journal_pages/_form.html.erb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/desktop/journal_pages/_form.html.erb b/app/views/desktop/journal_pages/_form.html.erb index 68c28047..8645318b 100644 --- a/app/views/desktop/journal_pages/_form.html.erb +++ b/app/views/desktop/journal_pages/_form.html.erb @@ -241,12 +241,14 @@ var new_id = $(this).prev().attr('value'); var old_id = new RegExp("new_writing_journal_files", "g"); $(this).prev().attr('value', parseInt(new_id) + 1); - $(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id)); + var newfield = $(("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id)); + $(this).parents('table').append(newfield); + newfield.find('.action a.delete').click(function(){ + newfield.remove(); + }); }); - $('.action a.delete').click(function(){ - $(this).parents('.list_item').remove(); - }); + $('.action a.remove_existing_record').click(function(){ $(this).next('.should_destroy').attr('value', 1);