Fixed a missing JS variable when deleting a photo from the album's admin page. This also now just removes the photo element from the DOM instead of reloading the whole page. #150

This commit is contained in:
Andy Heathershaw 2020-04-22 08:18:30 +01:00
parent c1a11eee17
commit 132bfcdb83

View File

@ -235,6 +235,7 @@ function EditPhotosViewModel(album_id, language, urls) {
deletePhoto: function (e) { deletePhoto: function (e) {
var self = this; var self = this;
this.selectPhotoSingle(e.target); this.selectPhotoSingle(e.target);
var parent = $(e.target).closest('.photo');
var photo_id = self.photoIDs[0]; var photo_id = self.photoIDs[0];
this.photoIDs = []; this.photoIDs = [];
@ -257,7 +258,7 @@ function EditPhotosViewModel(album_id, language, urls) {
$('.loading', parent).show(); $('.loading', parent).show();
$.post(url, {'_method': 'DELETE'}, function (data) { $.post(url, {'_method': 'DELETE'}, function (data) {
window.location.reload(); $(parent).remove();
}); });
} }
} }