« get me outta code hell

Add "Reveal" menu option for queue listing tracks - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/ui.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-05-26 10:46:24 -0300
committerFlorrie <towerofnix@gmail.com>2019-05-26 10:46:24 -0300
commitaa430cc193a6de8189a5a82529c877f5fff74321 (patch)
treed19450c6509065f29b50675bf4da7ff516d6ac9d /ui.js
parentecd9a95adc2ce079a11f88a9a0409572637893ab (diff)
Add "Reveal" menu option for queue listing tracks
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js26
1 files changed, 14 insertions, 12 deletions
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