From aa430cc193a6de8189a5a82529c877f5fff74321 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 26 May 2019 10:46:24 -0300 Subject: Add "Reveal" menu option for queue listing tracks --- todo.txt | 1 + ui.js | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/todo.txt b/todo.txt index 531accf..fc21476 100644 --- a/todo.txt +++ b/todo.txt @@ -240,3 +240,4 @@ TODO: An indicator for the number of tracks in the queue! (Done!) TODO: "Reveal" option in queue listing context menu. + (Done!) diff --git a/ui.js b/ui.js index 1457923..071714e 100644 --- a/ui.js +++ b/ui.js @@ -318,21 +318,21 @@ class AppElement extends FocusElement { // Sets up event listeners that are common to ordinary grouplike listings // (made by newGrouplikeListing) as well as the queue grouplike listing. - const handleSelectFromPathElement = item => { - const tabberListing = this.tabber.currentElement - this.root.select(tabberListing) - if (isGroup(item)) { - tabberListing.loadGrouplike(item) - } else if (item[parentSymbol]) { - tabberListing.loadGrouplike(item[parentSymbol]) - tabberListing.selectAndShow(item) - } - } - - grouplikeListing.pathElement.on('select', item => handleSelectFromPathElement(item)) + grouplikeListing.pathElement.on('select', item => this.reveal(item)) grouplikeListing.on('menu', (item, el) => this.showMenuForItemElement(el, grouplikeListing)) } + reveal(item) { + const tabberListing = this.tabber.currentElement + this.root.select(tabberListing) + if (isGroup(item)) { + tabberListing.loadGrouplike(item) + } else if (item[parentSymbol]) { + tabberListing.loadGrouplike(item[parentSymbol]) + tabberListing.selectAndShow(item) + } + } + showMenuForItemElement(el, listing) { const emitControls = play => () => { this.handleQueueOptions(item, { @@ -349,6 +349,8 @@ class AppElement extends FocusElement { let items; if (listing.grouplike.isTheQueue) { items = [ + {label: 'Reveal', action: () => this.reveal(item)}, + {divider: true}, {label: 'Play later', action: () => this.handleQueueOptions(item, { where: 'distribute-randomly', skip: true -- cgit 1.3.0-6-gf8a5