From 599262e309031353c8fb15e5d879c478663b8e2f Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 7 Nov 2011 21:04:44 +0000 Subject: [PATCH] fix a bug where selecting a clip (causing list selection), then navigating away from and back to that list, would not reset list selection --- static/js/pandora/UI.js | 20 +++++++++++++++++--- static/js/pandora/info.js | 10 ---------- static/js/pandora/viewSelect.js | 17 +---------------- 3 files changed, 18 insertions(+), 29 deletions(-) diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js index 2c4ec793..54cfee26 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 fae22d94..a18c1a03 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 fb9f76ad..dd96a81e 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);