map and calendar are clip views too

This commit is contained in:
rolux 2011-09-17 21:04:42 +00:00
parent eac4160fbb
commit 69c12f990c
4 changed files with 19 additions and 8 deletions

View file

@ -323,10 +323,11 @@ pandora.getListData = function() {
}; };
pandora.getSortMenu = function() { pandora.getSortMenu = function() {
var list = pandora.user.ui.lists[pandora.user.ui.list]; var list = pandora.user.ui.lists[pandora.user.ui.list],
isClipView = pandora.isClipView(list.listView);
return { id: 'sortMenu', title: 'Sort', items: [ return { id: 'sortMenu', title: 'Sort', items: [
{ id: 'sortmovies', title: 'Sort ' + (list.listView == 'clip' ? 'Clips' : pandora.site.itemName.plural) + ' by', items: [ { id: 'sortmovies', title: 'Sort ' + (isClipView ? 'Clips' : pandora.site.itemName.plural) + ' by', items: [
{ group: 'sortmovies', min: 1, max: 1, items: Ox.merge(list.listView == 'clip' ? Ox.merge(pandora.site.clipKeys.map(function(key) { { group: 'sortmovies', min: 1, max: 1, items: Ox.merge(isClipView ? Ox.merge(pandora.site.clipKeys.map(function(key) {
return Ox.extend(Ox.clone(key), { return Ox.extend(Ox.clone(key), {
checked: list.sort[0].key == key.id checked: list.sort[0].key == key.id
}); });
@ -336,7 +337,7 @@ pandora.getSortMenu = function() {
}, key); }, key);
})) } })) }
] }, ] },
{ id: 'ordermovies', title: 'Order ' + (list.listView == 'clip' ? 'Clips' : pandora.site.itemName.plural), items: [ { id: 'ordermovies', title: 'Order ' + (isClipView ? 'Clips' : pandora.site.itemName.plural), items: [
{ group: 'ordermovies', min: 1, max: 1, items: [ { group: 'ordermovies', min: 1, max: 1, items: [
{ id: 'ascending', title: 'Ascending', checked: (list.sort[0].operator || pandora.getSortOperator(list.sort[0].key)) == '+' }, { id: 'ascending', title: 'Ascending', checked: (list.sort[0].operator || pandora.getSortOperator(list.sort[0].key)) == '+' },
{ id: 'descending', title: 'Descending', checked: (list.sort[0].operator || pandora.getSortOperator(list.sort[0].key)) == '-' } { id: 'descending', title: 'Descending', checked: (list.sort[0].operator || pandora.getSortOperator(list.sort[0].key)) == '-' }
@ -383,6 +384,10 @@ pandora.getVideoPartsAndPoints = function(durations, points) {
return ret; return ret;
}; };
pandora.isClipView = function(view) {
return ['calendar', 'clip', 'map'].indexOf(view) > -1;
};
pandora.signin = function(data) { pandora.signin = function(data) {
pandora.user = data.user; pandora.user = data.user;
pandora.Query.updateGroups(); pandora.Query.updateGroups();

View file

@ -200,12 +200,17 @@ pandora.ui.mainMenu = function() {
defaultRatio: value == 'posters' ? 5/8 : 1 defaultRatio: value == 'posters' ? 5/8 : 1
}).reloadList(true); }).reloadList(true);
} else if (data.id == 'viewmovies') { } else if (data.id == 'viewmovies') {
var isClipView = pandora.isClipView(value),
wasClipView = pandora.isClipView(pandora.user.ui.lists[pandora.user.ui.list].listView);
pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), value); pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), value);
if (isClipView != wasClipView) {
pandora.$ui.mainMenu.replaceMenu('sortMenu', pandora.getSortMenu());
pandora.$ui.sortSelect.replaceWith(pandora.$ui.sortSelect = pandora.ui.sortSelect());
}
pandora.$ui.viewSelect.options({value: value}); pandora.$ui.viewSelect.options({value: value});
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.list = pandora.ui.list()); pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.list = pandora.ui.list());
pandora.URL.push('/' + value + '/' + document.location.search); pandora.URL.push('/' + value + '/' + document.location.search);
//pandora.URL.set('/' + value + '/' + document.location.search);
} }
}, },
click: function(data) { click: function(data) {

View file

@ -8,7 +8,7 @@ pandora.ui.sortSelect = function() {
}); });
}), }),
that; that;
if (list.listView == 'clip') { if (pandora.isClipView(list.listView)) {
items = Ox.merge(pandora.site.clipKeys.map(function(key) { items = Ox.merge(pandora.site.clipKeys.map(function(key) {
return Ox.extend(Ox.clone(key), { return Ox.extend(Ox.clone(key), {
checked: list.sort[0].key == key.id, checked: list.sort[0].key == key.id,

View file

@ -22,10 +22,11 @@ pandora.ui.viewSelect = function() {
.bindEvent({ .bindEvent({
change: !pandora.user.ui.item ? function(data) { change: !pandora.user.ui.item ? function(data) {
var view = data.selected[0].id, var view = data.selected[0].id,
wasClipView = pandora.user.ui.lists[pandora.user.ui.list].listView == 'clip'; isClipView = pandora.isClipView(view),
wasClipView = pandora.isClipView(pandora.user.ui.lists[pandora.user.ui.list].listView);
pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), view); pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), view);
pandora.$ui.mainMenu.checkItem('viewMenu_movies_' + view); pandora.$ui.mainMenu.checkItem('viewMenu_movies_' + view);
if (view == 'clip' || wasClipView) { if (isClipView != wasClipView) {
pandora.$ui.mainMenu.replaceMenu('sortMenu', pandora.getSortMenu()); pandora.$ui.mainMenu.replaceMenu('sortMenu', pandora.getSortMenu());
pandora.$ui.sortSelect.replaceWith(pandora.$ui.sortSelect = pandora.ui.sortSelect()); pandora.$ui.sortSelect.replaceWith(pandora.$ui.sortSelect = pandora.ui.sortSelect());
} }