From a9c8954780ce2c8422205cf3e57e03946d25480d Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 16 Aug 2011 14:19:37 +0000 Subject: [PATCH] more thorough fix for missing list preferences --- static/js/pandora.js | 3 +++ static/js/pandora/URL.js | 2 +- static/js/pandora/ui/folderBrowserList.js | 2 +- static/js/pandora/ui/menu.js | 14 ++++++-------- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/static/js/pandora.js b/static/js/pandora.js index 0b14c6c1f..cc3e13e87 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -89,6 +89,9 @@ Ox.load('Geo', function() { sectionElement: 'buttons', selectedMovies: [] }); + // fixme: this should not happen + !pandora.user.ui.lists[pandora.user.ui.list] + && pandora.user.ui.lists[pandora.user.ui.list] = pandora.user.ui.lists['']; if (data.user.level == 'guest' && $.browser.mozilla) { pandora.user.ui.theme = 'classic'; diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index fdd5bdfbb..fa029e136 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -39,7 +39,7 @@ pandora.URL = (function() { item: '' }); }, - '^(calendar|calendars|clips|icons|flow|map|maps|timelines)$': function() { + '^(calendar|calendars|clips|icons|flow|map|maps|timelines)$': function(url) { pandora.UI.set({ section: 'items', item: '' diff --git a/static/js/pandora/ui/folderBrowserList.js b/static/js/pandora/ui/folderBrowserList.js index 31b3991dd..ca3e83bdb 100644 --- a/static/js/pandora/ui/folderBrowserList.js +++ b/static/js/pandora/ui/folderBrowserList.js @@ -441,7 +441,7 @@ pandora.ui.folderList = function(id) { if (data.ids.length) { $.each(pandora.$ui.folderList, function(id_, $list) { id != id_ && $list.options('selected', []); - }) + }); pandora.URL.set('?find=list:' + data.ids[0]); } else { pandora.URL.set('?find='); diff --git a/static/js/pandora/ui/menu.js b/static/js/pandora/ui/menu.js index dfa1f2529..ea1110b48 100644 --- a/static/js/pandora/ui/menu.js +++ b/static/js/pandora/ui/menu.js @@ -73,8 +73,7 @@ pandora.ui.mainMenu = function() { { id: 'movies', title: 'View ' + pandora.site.itemName.plural, items: [ { group: 'viewmovies', min: 1, max: 1, items: $.map(pandora.site.listViews, function(view, i) { return Ox.extend({ - checked: pandora.user.ui.lists[pandora.user.ui.list] - && pandora.user.ui.lists[pandora.user.ui.list].listView == view.id, + checked: pandora.user.ui.lists[pandora.user.ui.list].listView == view.id, }, view); }) }, ]}, @@ -105,15 +104,14 @@ pandora.ui.mainMenu = function() { { id: 'sortmovies', title: 'Sort ' + pandora.site.itemName.plural + ' by', items: [ { group: 'sortmovies', min: 1, max: 1, items: $.map(pandora.site.sortKeys, function(key, i) { return Ox.extend({ - checked: pandora.user.ui.lists[pandora.user.ui.list] - && pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id + checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id }, key); }) } ] }, { id: 'ordermovies', title: 'Order ' + pandora.site.itemName.plural, items: [ { group: 'ordermovies', min: 1, max: 1, items: [ - { id: 'ascending', title: 'Ascending', checked: pandora.user.ui.lists[pandora.user.ui.list] && pandora.user.ui.lists[pandora.user.ui.list].sort[0].operator === '' }, - { id: 'descending', title: 'Descending', checked: pandora.user.ui.lists[pandora.user.ui.list] && pandora.user.ui.lists[pandora.user.ui.list].sort[0].operator == '-' } + { id: 'ascending', title: 'Ascending', checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].operator === '' }, + { id: 'descending', title: 'Descending', checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].operator == '-' } ]} ] }, { id: 'advancedsort', title: 'Advanced Sort...', keyboard: 'shift control s' }, @@ -178,7 +176,7 @@ pandora.ui.mainMenu = function() { else url(id); } else if (data.id == 'ordermovies') { - pandora.$ui.list.sortList(pandora.user.ui.lists[pandora.user.ui.list] && pandora.user.ui.lists[pandora.user.ui.list].sort[0].key, value == 'ascending' ? '' : '-'); + pandora.$ui.list.sortList(pandora.user.ui.lists[pandora.user.ui.list].sort[0].key, value == 'ascending' ? '' : '-'); } else if (data.id == 'sortmovies') { var operator = pandora.getSortOperator(value); pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending')); @@ -193,7 +191,7 @@ pandora.ui.mainMenu = function() { pandora.$ui.item.reload(); } $list = pandora.$ui.browser; - } else if (pandora.user.ui.lists[pandora.user.ui.list] && pandora.user.ui.lists[pandora.user.ui.list].listView == 'icons') { + } else if (pandora.user.ui.lists[pandora.user.ui.list].listView == 'icons') { $list = pandora.$ui.list } $list && $list.options({