Browse Source

Fixed sorting of move and switch album context menu

Tobias Reich 9 years ago
parent
commit
5c40f43290
2 changed files with 15 additions and 17 deletions
  1. 0 0
      dist/main.js
  2. 15 17
      src/scripts/contextMenu.js

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


+ 15 - 17
src/scripts/contextMenu.js

@@ -71,16 +71,12 @@ contextMenu.albumMulti = function(albumIDs, e) {
 
 contextMenu.albumTitle = function(albumID, e) {
 
-	var items = [
-		{ type: 'item', title: build.iconic('pencil') + 'Rename', fn: function() { album.setTitle([albumID]) } }
-	];
+	var items = [];
 
 	api.post('Album::getAll', {}, function(data) {
 
 		if (data.num>1) {
 
-			items.push({ type: 'separator' });
-
 			// Generate list of albums
 			$.each(data.albums, function(index) {
 
@@ -91,12 +87,16 @@ contextMenu.albumTitle = function(albumID, e) {
 
 				title = "<img class='cover' width='16' height='16' src='" + that.thumbs[0] + "'><div class='title'>" + that.title + "</div>";
 
-				if (that.id!=albumID) items.push({ type: 'item', title, fn: function() { lychee.goto(that.id) } });
+				if (that.id!=albumID) items.unshift({ type: 'item', title, fn: function() { lychee.goto(that.id) } });
 
 			});
 
+			items.unshift({ type: 'separator' });
+
 		}
 
+		items.unshift({ type: 'item', title: build.iconic('pencil') + 'Rename', fn: function() { album.setTitle([albumID]) } });
+
 		basicContext.show(items, e, contextMenu.close);
 
 	});
@@ -198,16 +198,6 @@ contextMenu.move = function(photoIDs, e) {
 
 	var items = [];
 
-	// Show Unsorted when unsorted is not the current album
-	if (album.getID()!=='0') {
-
-		items = [
-			{ type: 'item', title: 'Unsorted', fn: function() { photo.setAlbum(photoIDs, 0) } },
-			{ type: 'separator' }
-		];
-
-	}
-
 	api.post('Album::getAll', {}, function(data) {
 
 		if (data.num===0) {
@@ -227,10 +217,18 @@ contextMenu.move = function(photoIDs, e) {
 				if (!that.thumbs[0]) that.thumbs[0] = 'src/images/no_cover.svg';
 				that.title = "<img class='cover' width='16' height='16' src='" + that.thumbs[0] + "'><div class='title'>" + that.title + "</div>";
 
-				if (that.id!=album.getID()) items.push({ type: 'item', title: that.title, fn: function() { photo.setAlbum(photoIDs, that.id) } });
+				if (that.id!=album.getID()) items.unshift({ type: 'item', title: that.title, fn: function() { photo.setAlbum(photoIDs, that.id) } });
 
 			});
 
+			// Show Unsorted when unsorted is not the current album
+			if (album.getID()!=='0') {
+
+				items.unshift({ type: 'separator' });
+				items.unshift({ type: 'item', title: 'Unsorted', fn: function() { photo.setAlbum(photoIDs, 0) } });
+
+			}
+
 		}
 
 		basicContext.show(items, e, contextMenu.close);

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