diff --git a/app/views/photos/_new_photo.haml b/app/views/photos/_new_photo.haml index 54ae7adcd..1f8f9fc62 100644 --- a/app/views/photos/_new_photo.haml +++ b/app/views/photos/_new_photo.haml @@ -45,28 +45,25 @@ $('#new_status_message').append(""); $('#photodropzone').append( - "
  • " + - "" + + "
  • " + + "" + "
    X
    " + "
    " + "
  • " ); $('#publisher').find("input[type='submit']").removeAttr('disabled'); - $('.x').live('mousedown', function(){ - var photo = $(this).closest('li'); + $('.x').live('click', function(){ + var photo = $(this).closest('.publisher_photo'); photo.addClass("dim"); $.ajax({url: "photos/" + photo.children('img').attr('data-id'), type: 'DELETE', success: function() { photo.fadeOut(400, function(){ photo.remove(); + if ( $('.publisher_photo').length == 0){ + $("#publisher textarea").removeClass("with_attachments"); + } }); - alert( $('#photodropzone').children().index('img') ); - if ( $('#photodropzone').children().index('li') == -1){ - alert("last one"); - $("#publisher textarea").removeClass("with_attachments"); - } - } }); });