diff options
author | Florrie <towerofnix@gmail.com> | 2019-05-26 10:46:24 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-05-26 10:46:24 -0300 |
commit | aa430cc193a6de8189a5a82529c877f5fff74321 (patch) | |
tree | d19450c6509065f29b50675bf4da7ff516d6ac9d | |
parent | ecd9a95adc2ce079a11f88a9a0409572637893ab (diff) |
Add "Reveal" menu option for queue listing tracks
-rw-r--r-- | todo.txt | 1 | ||||
-rw-r--r-- | 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 |