From d32115333e3d35b98b8c09723d563026a34e306d Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 14:07:03 +0200 Subject: [PATCH] Fixed error when using "Merge All" with one selected album --- dist/main.js | Bin 177367 -> 177620 bytes src/scripts/contextMenu.js | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) mode change 100755 => 100644 dist/main.js diff --git a/dist/main.js b/dist/main.js old mode 100755 new mode 100644 index 71bef1858e22892acb76f7d485263b7d379ca739..f26b800f7f095755de2d03455565a053cdc8be6e GIT binary patch delta 166 zcmccqlIzNAu7)j)w~jEyT2GHV&L}l~!f8gn>AJTWxuzSO19Ih$G75`m>g4Galon@b zr0V6Q=B1Zp*csYSXFSYkK0WIwqY9%Hh+V=JZ4j$dqFGz3se@$FhNFz;OhA##hZ&=$ zE1zIA->z_s@sBREH5b=(nJh($ delta 104 zcmV-u0GI#N>k8ND3V^f$+QgSe&H*8p%fbN=mlVYTCzn{y0V0=h#Q{2(wa)<}mz=`^ z50_xZ0VtP#&;dr5V8Q_fw=Ks3>MfTV^#Q&C3YS3j0U5XP^#L$^mkHhhB$r2W0+<2{ K3b)^K0`)>n-z!A` diff --git a/src/scripts/contextMenu.js b/src/scripts/contextMenu.js index 69be4ac..c8e3022 100644 --- a/src/scripts/contextMenu.js +++ b/src/scripts/contextMenu.js @@ -68,11 +68,19 @@ contextMenu.albumMulti = function(albumIDs, e) { multiselect.stopResize(); - var items = [ - { type: 'item', title: build.iconic('pencil') + 'Rename All', fn: function() { album.setTitle(albumIDs) } }, - { type: 'item', title: build.iconic('collapse-left') + 'Merge All', fn: function () { album.merge(albumIDs) } }, - { type: 'item', title: build.iconic('trash') + 'Delete All', fn: function() { album.delete(albumIDs) } } - ]; + var items = []; + + items.push({ type: 'item', title: build.iconic('pencil') + 'Rename All', fn: function() { album.setTitle(albumIDs) } }); + + // Automatically merge selected albums when albumIDs contains more than one album + // Show list of albums otherwise + if (albumIDs.length>1) items.push({ type: 'item', title: build.iconic('collapse-left') + 'Merge All', fn: function () { album.merge(albumIDs) } }); + else items.push({ type: 'item', title: build.iconic('collapse-left') + 'Merge', fn: function () { basicContext.close(); contextMenu.mergeAlbum(albumIDs[0], e) } }) + + items.push({ type: 'item', title: build.iconic('trash') + 'Delete All', fn: function() { album.delete(albumIDs) } }); + + // Remove merge when there is only one album + if (albums.json&&albums.json.albums&&Object.keys(albums.json.albums).length<=1) items.splice(1, 1); basicContext.show(items, e.originalEvent, contextMenu.close);