From 132bfcdb83105298eb063c0f3068d6d15c45e6de Mon Sep 17 00:00:00 2001 From: Andy Heathershaw Date: Wed, 22 Apr 2020 08:18:30 +0100 Subject: [PATCH] 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 --- resources/js/albums.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/js/albums.js b/resources/js/albums.js index 6ff2160..d9362c4 100644 --- a/resources/js/albums.js +++ b/resources/js/albums.js @@ -235,6 +235,7 @@ function EditPhotosViewModel(album_id, language, urls) { deletePhoto: function (e) { var self = this; this.selectPhotoSingle(e.target); + var parent = $(e.target).closest('.photo'); var photo_id = self.photoIDs[0]; this.photoIDs = []; @@ -257,7 +258,7 @@ function EditPhotosViewModel(album_id, language, urls) { $('.loading', parent).show(); $.post(url, {'_method': 'DELETE'}, function (data) { - window.location.reload(); + $(parent).remove(); }); } }