fix bug in menu (check if a list exists in user ui prefs before accessing its properties)

This commit is contained in:
rolux 2011-08-16 13:41:43 +00:00
parent db0d3aea01
commit 2381ddb9ca

View file

@ -72,8 +72,9 @@ pandora.ui.mainMenu = function() {
{ id: 'viewMenu', title: 'View', items: [ { id: 'viewMenu', title: 'View', items: [
{ id: 'movies', title: 'View ' + pandora.site.itemName.plural, items: [ { id: 'movies', title: 'View ' + pandora.site.itemName.plural, items: [
{ group: 'viewmovies', min: 1, max: 1, items: $.map(pandora.site.listViews, function(view, i) { { group: 'viewmovies', min: 1, max: 1, items: $.map(pandora.site.listViews, function(view, i) {
return $.extend({ return Ox.extend({
checked: pandora.user.ui.lists[pandora.user.ui.list].listView == view.id, checked: pandora.user.ui.lists[pandora.user.ui.list]
? pandora.user.ui.lists[pandora.user.ui.list].listView == view.id : false,
}, view); }, view);
}) }, }) },
]}, ]},
@ -89,7 +90,7 @@ pandora.ui.mainMenu = function() {
{}, {},
{ id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], disabled: true, items: [ { id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], disabled: true, items: [
{ group: 'movieview', min: 1, max: 1, items: $.map(pandora.site.itemViews, function(view, i) { { group: 'movieview', min: 1, max: 1, items: $.map(pandora.site.itemViews, function(view, i) {
return $.extend({ return Ox.extend({
checked: pandora.user.ui.itemView == view.id, checked: pandora.user.ui.itemView == view.id,
}, view); }, view);
}) }, }) },
@ -103,8 +104,9 @@ pandora.ui.mainMenu = function() {
{ id: 'sortMenu', title: 'Sort', items: [ { id: 'sortMenu', title: 'Sort', items: [
{ id: 'sortmovies', title: 'Sort ' + pandora.site.itemName.plural + ' by', items: [ { id: 'sortmovies', title: 'Sort ' + pandora.site.itemName.plural + ' by', items: [
{ group: 'sortmovies', min: 1, max: 1, items: $.map(pandora.site.sortKeys, function(key, i) { { group: 'sortmovies', min: 1, max: 1, items: $.map(pandora.site.sortKeys, function(key, i) {
return $.extend({ return Ox.extend({
checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id, checked: pandora.user.ui.lists[pandora.user.ui.list]
? pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id : false,
}, key); }, key);
}) } }) }
] }, ] },
@ -121,7 +123,7 @@ pandora.ui.mainMenu = function() {
{ id: 'findMenu', title: 'Find', items: [ { id: 'findMenu', title: 'Find', items: [
{ id: 'find', title: 'Find', items: [ { id: 'find', title: 'Find', items: [
{ group: 'find', min: 1, max: 1, items: $.map(pandora.site.findKeys, function(key, i) { { group: 'find', min: 1, max: 1, items: $.map(pandora.site.findKeys, function(key, i) {
return $.extend({ return Ox.extend({
checked: pandora.user.ui.findQuery.conditions.length && checked: pandora.user.ui.findQuery.conditions.length &&
(pandora.user.ui.findQuery.conditions[0].key == key.id || (pandora.user.ui.findQuery.conditions[0].key == key.id ||
(pandora.user.ui.findQuery.conditions[0].key === '' && key.id == 'all')), (pandora.user.ui.findQuery.conditions[0].key === '' && key.id == 'all')),