removing photo from publisher works
This commit is contained in:
parent
b7f78335e1
commit
5ebd10e43f
1 changed files with 7 additions and 10 deletions
|
|
@ -45,28 +45,25 @@
|
||||||
|
|
||||||
$('#new_status_message').append("<input type='hidden' value='" + id + "' name='photos[]' />");
|
$('#new_status_message').append("<input type='hidden' value='" + id + "' name='photos[]' />");
|
||||||
$('#photodropzone').append(
|
$('#photodropzone').append(
|
||||||
"<li style='position:relative;'>" +
|
"<li class='publisher_photo' style='position:relative;'>" +
|
||||||
"<img src='" + url +"' data-id='" + id + "' />" +
|
"<img src='" + url +"' data-id='" + id + "' />" +
|
||||||
"<div class='x'> X </div>" +
|
"<div class='x'> X </div>" +
|
||||||
"<div class='circle'></div>" +
|
"<div class='circle'></div>" +
|
||||||
"</li>"
|
"</li>"
|
||||||
);
|
);
|
||||||
$('#publisher').find("input[type='submit']").removeAttr('disabled');
|
$('#publisher').find("input[type='submit']").removeAttr('disabled');
|
||||||
$('.x').live('mousedown', function(){
|
$('.x').live('click', function(){
|
||||||
var photo = $(this).closest('li');
|
var photo = $(this).closest('.publisher_photo');
|
||||||
photo.addClass("dim");
|
photo.addClass("dim");
|
||||||
$.ajax({url: "photos/" + photo.children('img').attr('data-id'),
|
$.ajax({url: "photos/" + photo.children('img').attr('data-id'),
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
success: function() {
|
success: function() {
|
||||||
photo.fadeOut(400, function(){
|
photo.fadeOut(400, function(){
|
||||||
photo.remove();
|
photo.remove();
|
||||||
});
|
if ( $('.publisher_photo').length == 0){
|
||||||
alert( $('#photodropzone').children().index('img') );
|
|
||||||
if ( $('#photodropzone').children().index('li') == -1){
|
|
||||||
alert("last one");
|
|
||||||
$("#publisher textarea").removeClass("with_attachments");
|
$("#publisher textarea").removeClass("with_attachments");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue