From 48931fde5b41ea933b7cde877c6e20c8b79002c1 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 6 Mar 2016 17:48:40 +0100 Subject: [PATCH] Unnamed albums/photos now named "Untitled" in move album, merge album and switch album/photo menus --- src/scripts/contextMenu.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/scripts/contextMenu.js b/src/scripts/contextMenu.js index fc1f245..1782cc0 100644 --- a/src/scripts/contextMenu.js +++ b/src/scripts/contextMenu.js @@ -100,10 +100,14 @@ contextMenu.albumTitle = function(albumID, e) { $.each(data.albums, function() { if (!this.thumbs[0]) this.thumbs[0] = 'src/images/no_cover.svg' + if (this.title==='') this.title = 'Untitled' - let title = lychee.html`
$${ this.title }
` + let html = lychee.html`
$${ this.title }
` - if (this.id!=albumID) items.push({ title, fn: () => lychee.goto(this.id) }) + if (this.id!=albumID) items.push({ + title: html, + fn: () => lychee.goto(this.id) + }) }) @@ -130,10 +134,14 @@ contextMenu.mergeAlbum = function(albumID, e) { $.each(data.albums, function() { if (!this.thumbs[0]) this.thumbs[0] = 'src/images/no_cover.svg' + if (this.title==='') this.title = 'Untitled' - let title = lychee.html`
$${ this.title }
` + let html = lychee.html`
$${ this.title }
` - if (this.id!=albumID) items.push({ title, fn: () => album.merge([ albumID, this.id ]) }) + if (this.id!=albumID) items.push({ + title: html, + fn: () => album.merge([ albumID, this.id ]) + }) }) @@ -206,9 +214,14 @@ contextMenu.photoTitle = function(albumID, photoID, e) { // Generate list of albums $.each(data.content, function(index) { - let title = lychee.html`
$${ this.title }
` + if (this.title==='') this.title = 'Untitled' - if (this.id!=photoID) items.push({ title, fn: () => lychee.goto(albumID + '/' + this.id) }) + let html = lychee.html`
$${ this.title }
` + + if (this.id!=photoID) items.push({ + title: html, + fn: () => lychee.goto(albumID + '/' + this.id) + }) }) @@ -253,10 +266,14 @@ contextMenu.move = function(photoIDs, e) { $.each(data.albums, function() { if (!this.thumbs[0]) this.thumbs[0] = 'src/images/no_cover.svg' + if (this.title==='') this.title = 'Untitled' - let title = lychee.html`
$${ this.title }
` + let html = lychee.html`
$${ this.title }
` - if (this.id!=album.getID()) items.push({ title, fn: () => photo.setAlbum(photoIDs, this.id) }) + if (this.id!=album.getID()) items.push({ + title: html, + fn: () => photo.setAlbum(photoIDs, this.id) + }) })