preserve selection when switching from featured browser to featured folder and the selected list is not featured, but a favorite

This commit is contained in:
rlx 2011-09-04 16:42:34 +00:00
parent c5c608e513
commit 0920f38ce5
2 changed files with 11 additions and 4 deletions

View File

@ -126,7 +126,7 @@ pandora.ui.folderBrowserList = function(id) {
},
visible: true,
width: 16
},
}
],
columnsVisible: true,
items: function(data, callback) {
@ -140,6 +140,10 @@ pandora.ui.folderBrowserList = function(id) {
query: query
}), callback);
},
// needed in order to determine if, when switching back
// from featured browser to featured folder, the selected
// not-featured list may be in the user's favorites folder
keys: id == 'featured' ? ['subscribed'] : [],
pageLength: 1000,
selected: pandora.getListData().folder == id ? [pandora.user.ui.list] : [],
sort: [

View File

@ -90,7 +90,7 @@ pandora.ui.folders = function() {
pandora.$ui.folderList.favorite.options('selected').length
&& !listData.subscribed
) {
// the selected list in the favorite browser is not in the favorite folder
// the selected list in the favorites browser is not in the favorites folder
pandora.$ui.folderList.favorite.options({selected: []});
if (Ox.getObjectById(pandora.site.sectionFolders.items, 'featured').showBrowser) {
// but in the featured browser
@ -140,8 +140,11 @@ pandora.ui.folders = function() {
if (listData.user == pandora.user.username) {
// but in the personal folder
pandora.$ui.folderList.personal.options({selected: [listData.id]});
} else if (Ox.getObjectById(pandora.site.sectionFolders.items, 'favorite').showBrowser) {
// but in the favorite browser
} else if (
listData.subscribed
|| Ox.getObjectById(pandora.site.sectionFolders.items, 'favorite').showBrowser
) {
// but in the favorites folder or browser
pandora.$ui.folderList.favorite.options({selected: [listData.id]});
} else {
// and nowhere else