diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js index 2c4ec793f..54cfee266 100644 --- a/static/js/pandora/UI.js +++ b/static/js/pandora/UI.js @@ -62,7 +62,7 @@ pandora.UI = (function() { // switch from item view to list view args['item'] = ''; } - add['itemFind'] = pandora.site.user.ui.itemFind; + add.itemFind = pandora.site.user.ui.itemFind; if (list != self.previousUI._list) { Ox.Log('', 'FIND HAS CHANGED LIST') // if find has changed list @@ -82,10 +82,24 @@ pandora.UI = (function() { } else { list = self.previousUI._list; } - - item = args['item'] || pandora.user.ui.item; // it is important to check for find first, so that // 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]) { add['lists.' + that.encode(list)] = {}; } diff --git a/static/js/pandora/info.js b/static/js/pandora/info.js index fae22d944..a18c1a033 100644 --- a/static/js/pandora/info.js +++ b/static/js/pandora/info.js @@ -50,16 +50,6 @@ pandora.ui.info = function() { pandora.$ui.leftPanel.size(2, height); pandora.resizeFolders(); !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() { diff --git a/static/js/pandora/viewSelect.js b/static/js/pandora/viewSelect.js index fb9f76ada..dd96a81e0 100644 --- a/static/js/pandora/viewSelect.js +++ b/static/js/pandora/viewSelect.js @@ -26,22 +26,7 @@ pandora.ui.viewSelect = function() { }) .bindEvent({ change: function(data) { - var key = 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.UI.set(viewKey, data.selected[0].id); }, pandora_listview: function(data) { that.selectItem(data.value);