fix a bug where selecting a clip (causing list selection), then navigating away from and back to that list, would not reset list selection

This commit is contained in:
rolux 2011-11-07 21:04:44 +00:00
parent 4245a776ed
commit 599262e309
3 changed files with 18 additions and 29 deletions

View file

@ -62,7 +62,7 @@ pandora.UI = (function() {
// switch from item view to list view // switch from item view to list view
args['item'] = ''; args['item'] = '';
} }
add['itemFind'] = pandora.site.user.ui.itemFind; add.itemFind = pandora.site.user.ui.itemFind;
if (list != self.previousUI._list) { if (list != self.previousUI._list) {
Ox.Log('', 'FIND HAS CHANGED LIST') Ox.Log('', 'FIND HAS CHANGED LIST')
// if find has changed list // if find has changed list
@ -82,10 +82,24 @@ pandora.UI = (function() {
} else { } else {
list = self.previousUI._list; list = self.previousUI._list;
} }
item = args['item'] || pandora.user.ui.item;
// it is important to check for find first, so that // it is important to check for find first, so that
// if find changes list, list is correct here // if find changes list, list is correct here
item = args.item || pandora.user.ui.item;
if (args.listView) {
Ox.print('XXX')
if (pandora.isClipView(args.listView)) {
Ox.print('YYY')
// when switching to a clip view, clear list selection
args.listSelection = [];
} else if (['text', 'position'].indexOf(pandora.user.ui.listSort[0].key) > -1) {
Ox.print('ZZZ')
// when switchin to a non-clip view, with a sort key that
// only exists in clip view, reset sort to default
args.listSort = pandora.site.user.ui.listSort;
}
}
if (!pandora.user.ui.lists[list]) { if (!pandora.user.ui.lists[list]) {
add['lists.' + that.encode(list)] = {}; add['lists.' + that.encode(list)] = {};
} }

View file

@ -50,16 +50,6 @@ pandora.ui.info = function() {
pandora.$ui.leftPanel.size(2, height); pandora.$ui.leftPanel.size(2, height);
pandora.resizeFolders(); pandora.resizeFolders();
!ui.showInfo && pandora.$ui.leftPanel.css({bottom: -height + 'px'}); !ui.showInfo && pandora.$ui.leftPanel.css({bottom: -height + 'px'});
/*
if (ui.showInfo) {
pandora.$ui.leftPanel.size(2, height, function() {
pandora.resizeFolders();
});
} else {
pandora.$ui.leftPanel.css({bottom: -height + 'px'});
pandora.resizeFolders();
}
*/
} }
function updateInfo() { function updateInfo() {

View file

@ -26,22 +26,7 @@ pandora.ui.viewSelect = function() {
}) })
.bindEvent({ .bindEvent({
change: function(data) { change: function(data) {
var key = data.selected[0].id, pandora.UI.set(viewKey, data.selected[0].id);
set = {};
set[viewKey] = key;
// FIXME: this may not work on page load, and would then have to be part of UI.js
if (!ui.item) {
// when changing the list view ...
if (pandora.isClipView(key)) {
// ... to a clip view, set listSelection to empty
set.listSelection = [];
} else if (['text', 'position'].indexOf(ui.listSort[0].key) > -1) {
// ... to a non-clip view, with a sort key that only exists
// in clip views, reset listSort to the default listSort
set.listSort = pandora.site.user.ui.listSort;
}
}
pandora.UI.set(set);
}, },
pandora_listview: function(data) { pandora_listview: function(data) {
that.selectItem(data.value); that.selectItem(data.value);