BLUE-18: adjusted the "select all" logic that if a user un-selects a photo, the "select all in album" flag is also un-selected

This commit is contained in:
Andy Heathershaw 2016-10-30 19:14:00 +00:00
parent 2f65c6085d
commit 1c0d2af035

View File

@ -120,6 +120,17 @@ function EditPhotosViewModel(album_id, language, urls) {
self.isSubmitting = false;
self.selectAllInAlbum = ko.observable(0);
// When a photo is un-selected, remove the "select all in album" flag as the user has overridden the selection
self.photoIDs.subscribe(function (changes)
{
if (changes[0].status !== 'deleted')
{
return;
}
self.selectAllInAlbum(0);
}, null, 'arrayChange');
/* Called when the Apply button on the "bulk apply selected actions" form is clicked */
self.bulkModifySelected = function()
{
@ -410,9 +421,9 @@ function EditPhotosViewModel(album_id, language, urls) {
callback: function()
{
self.selectAllInAlbum(0);
for (i = 0; i < self.photoIDsAvailable().length; i++)
for (photoID in self.photoIDsAvailable())
{
self.photoIDs.push(self.photoIDsAvailable()[i]);
self.photoIDs.push(photoID);
}
}
}