From c40b45efc43f83a301531e9e0d239eaf98351f5f Mon Sep 17 00:00:00 2001 From: Florrie Date: Wed, 15 Aug 2018 16:36:02 -0300 Subject: Fix path element not working in queue listing --- ui.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ui.js b/ui.js index 0314fba..befa764 100644 --- a/ui.js +++ b/ui.js @@ -53,6 +53,7 @@ class AppElement extends FocusElement { this.newGrouplikeListing() this.queueListingElement = new QueueListingElement(this.recordStore) + this.setupCommonGrouplikeListingEvents(this.queueListingElement) this.queueListingElement.loadGrouplike(this.queueGrouplike) this.paneRight.addChild(this.queueListingElement) @@ -203,19 +204,28 @@ class AppElement extends FocusElement { } }) + this.setupCommonGrouplikeListingEvents(grouplikeListing) + + return grouplikeListing + } + + setupCommonGrouplikeListingEvents(grouplikeListing) { + // Sets up event listeners that are common to ordinary grouplike listings + // (made by newGrouplikeListing) as well as the queue grouplike listing. + const handleSelectFromPathElement = item => { - this.root.select(grouplikeListing) + const tabberListing = this.tabber.currentElement + this.root.select(tabberListing) if (isGroup(item)) { - grouplikeListing.loadGrouplike(item) + tabberListing.loadGrouplike(item) } else if (item[parentSymbol]) { - grouplikeListing.loadGrouplike(item[parentSymbol]) - grouplikeListing.selectAndShow(item) + tabberListing.loadGrouplike(item[parentSymbol]) + tabberListing.selectAndShow(item) } } grouplikeListing.pathElement.on('select', item => handleSelectFromPathElement(item)) - return grouplikeListing } async handlePlaylistSource(source, newTab = false) { -- cgit 1.3.0-6-gf8a5