Browse Source

Fixed error when using "Merge All" with one selected album

Tobias Reich 8 years ago
parent
commit
d32115333e
2 changed files with 13 additions and 5 deletions
  1. 0 0
      dist/main.js
  2. 13 5
      src/scripts/contextMenu.js

File diff suppressed because it is too large
+ 0 - 0
dist/main.js


+ 13 - 5
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);
 

Some files were not shown because too many files changed in this diff