delete fixed..

This commit is contained in:
Harry Bomrah 2012-11-29 13:35:08 +08:00
parent 5272f20bea
commit 5b05e4ed3a
1 changed files with 6 additions and 4 deletions

View File

@ -241,12 +241,14 @@
var new_id = $(this).prev().attr('value'); var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_writing_journal_files", "g"); var old_id = new RegExp("new_writing_journal_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1); $(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(){ $('.action a.remove_existing_record').click(function(){
$(this).next('.should_destroy').attr('value', 1); $(this).next('.should_destroy').attr('value', 1);