From ae28b99ae8e25f21ab4a215ee225488cae2a1544 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 30 Oct 2011 16:49:29 +0000 Subject: [PATCH] make find all movies / find this list switch work --- static/js/pandora/UI.js | 1 + static/js/pandora/findElement.js | 35 +++++++++----------------------- static/js/pandora/folders.js | 13 +++++++++--- static/js/pandora/mainPanel.js | 2 +- static/js/pandora/toolbar.js | 15 +++++--------- 5 files changed, 27 insertions(+), 39 deletions(-) diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js index 86ce18ec..d42662cd 100644 --- a/static/js/pandora/UI.js +++ b/static/js/pandora/UI.js @@ -60,6 +60,7 @@ pandora.UI = (function() { add['lists.' + that.encode(list)] = {}; } if (list != self.previousUI._list) { + Ox.print('FIND HAS CHANGED LIST') if (!pandora.user.ui.lists[list]) { add['lists.' + that.encode(list)] = {}; } diff --git a/static/js/pandora/findElement.js b/static/js/pandora/findElement.js index 18a42d7b..0d13973e 100644 --- a/static/js/pandora/findElement.js +++ b/static/js/pandora/findElement.js @@ -77,34 +77,19 @@ pandora.ui.findElement = function() { var findInList = pandora.user.ui._list && pandora.$ui.findListSelect.value() == 'list', key = pandora.$ui.findSelect.value(), - conditions = data.value ? [{ - key: key, - value: data.value, - operator: '=' - }] : []; - if (findInList) { - pandora.UI.set('find', { - conditions: Ox.merge([{ + conditions = Ox.merge( + findInList ? [{ key: 'list', value: pandora.user.ui._list, operator: '==' - }], conditions), - operator: '&' - }); - // fixme: what was this? - // data.value && findIndex == 0 && pandora.user.ui.find.conditions.reverse(); - } else { - if (pandora.user.ui._list) { - Ox.forEach(pandora.$ui.folderList, function($list) { - $list.options({selected: []}); - }); - pandora.UI.set({list: ''}); - } - pandora.UI.set('find', { - conditions: conditions, - operator: '&' - }); - } + }] : [], + data.value ? [{ + key: key, + value: data.value, + operator: '=' + }] : [] + ); + pandora.UI.set('find', {conditions: conditions, operator: '&'}); } }) ]), diff --git a/static/js/pandora/folders.js b/static/js/pandora/folders.js index f85fbc02..13fcb050 100644 --- a/static/js/pandora/folders.js +++ b/static/js/pandora/folders.js @@ -308,8 +308,15 @@ pandora.ui.folders = function() { } }); } - that.toggle = function() { - - }; + that.bindEvent({ + pandora_find: function() { + var previousUI = pandora.UI.getPrevious(); + if (!pandora.user.ui._list && previousUI._list) { + Ox.forEach(pandora.$ui.folderList, function($list) { + $list.options({selected: []}); + }); + } + } + }) return that; }; diff --git a/static/js/pandora/mainPanel.js b/static/js/pandora/mainPanel.js index 57eaf572..66220aa2 100644 --- a/static/js/pandora/mainPanel.js +++ b/static/js/pandora/mainPanel.js @@ -20,7 +20,7 @@ pandora.ui.mainPanel = function() { .bindEvent({ pandora_find: function() { var previousUI = pandora.UI.getPrevious(); - if (pandora.user.ui._list == previousUI._list && pandora.$ui.list) { + if (!pandora.user.ui.item && pandora.user.ui._list == previousUI._list) { if (['map', 'calendar'].indexOf(pandora.user.ui.listView) > -1) { pandora.$ui.contentPanel.replaceElement(1, pandora.ui.navigationView(pandora.user.ui.listView) diff --git a/static/js/pandora/toolbar.js b/static/js/pandora/toolbar.js index 3120d96c..16c004af 100644 --- a/static/js/pandora/toolbar.js +++ b/static/js/pandora/toolbar.js @@ -13,16 +13,11 @@ pandora.ui.toolbar = function() { that.append( pandora.$ui.viewSelect = pandora.ui.viewSelect() ); - if (!ui.item && pandora.isClipView()) { - that.append( - pandora.$ui.sortSelect = pandora.ui.sortSelect() - ); - } - if (!ui.item && pandora.isClipView()) { - that.append( - pandora.$ui.orderButton = pandora.ui.orderButton() - ); - } + !ui.item && that.append( + pandora.$ui.sortSelect = pandora.ui.sortSelect() + ).append( + pandora.$ui.orderButton = pandora.ui.orderButton() + ); that.append( pandora.$ui.findElement = pandora.ui.findElement() );