make url controller handle listview change; properly set selected item when switching to and from clips view
This commit is contained in:
parent
9050feed9d
commit
4b523361fe
5 changed files with 19 additions and 10 deletions
|
@ -211,9 +211,16 @@ pandora.URL = (function() {
|
||||||
Ox.print('EQUAL', pandora.user.ui.findQuery, oldUserUI.findQuery)
|
Ox.print('EQUAL', pandora.user.ui.findQuery, oldUserUI.findQuery)
|
||||||
pandora.$ui.contentPanel.replaceElement(1, pandora.ui.list());
|
pandora.$ui.contentPanel.replaceElement(1, pandora.ui.list());
|
||||||
} else {
|
} else {
|
||||||
|
if (pandora.isClipView()) {
|
||||||
|
pandora.UI.set('lists|' + pandora.user.ui.list + '|selected', []);
|
||||||
|
}
|
||||||
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
|
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
|
||||||
|
if (pandora.user.ui.list == oldUserUI.list) {
|
||||||
|
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.list = pandora.ui.list());
|
||||||
|
} else {
|
||||||
pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// fixme: should list selection and deselection happen here?
|
// fixme: should list selection and deselection happen here?
|
||||||
// (home and menu may cause a list switch)
|
// (home and menu may cause a list switch)
|
||||||
} else if (!pandora.user.ui.item || !oldUserUI.item) {
|
} else if (!pandora.user.ui.item || !oldUserUI.item) {
|
||||||
|
|
|
@ -445,6 +445,7 @@ pandora.getVideoPartsAndPoints = function(durations, points) {
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.isClipView = function(view) {
|
pandora.isClipView = function(view) {
|
||||||
|
view = view || pandora.user.ui.lists[pandora.user.ui.list].listView;
|
||||||
return ['calendar', 'clip', 'map'].indexOf(view) > -1;
|
return ['calendar', 'clip', 'map'].indexOf(view) > -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
pandora.ui.info = function(id) {
|
pandora.ui.info = function() {
|
||||||
var list = pandora.user.ui.lists[pandora.user.ui.list],
|
var list = pandora.user.ui.lists[pandora.user.ui.list],
|
||||||
id = id || pandora.user.ui.item || (list.selected.length ? list.selected[list.selected.length - 1] : null),
|
id = pandora.user.ui.item || (list.selected.length ? list.selected[list.selected.length - 1] : null),
|
||||||
view = getView(),
|
view = getView(),
|
||||||
that = Ox.Element()
|
that = Ox.Element()
|
||||||
.css({overflowX: 'hidden', overflowY: 'auto'})
|
.css({overflowX: 'hidden', overflowY: 'auto'})
|
||||||
|
@ -11,6 +11,7 @@ pandora.ui.info = function(id) {
|
||||||
pandora.resizeFolders();
|
pandora.resizeFolders();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Ox.print('INFO', view)
|
||||||
if (view == 'list') {
|
if (view == 'list') {
|
||||||
that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo(list));
|
that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo(list));
|
||||||
} else if (view == 'poster') {
|
} else if (view == 'poster') {
|
||||||
|
@ -36,7 +37,7 @@ pandora.ui.info = function(id) {
|
||||||
pandora.$ui.leftPanel && resize();
|
pandora.$ui.leftPanel && resize();
|
||||||
function getView() {
|
function getView() {
|
||||||
return !id ? 'list'
|
return !id ? 'list'
|
||||||
: !pandora.user.ui.item && pandora.isClipView(list.listView) ? 'poster'
|
: !pandora.user.ui.item && pandora.isClipView() ? 'poster'
|
||||||
: 'video';
|
: 'video';
|
||||||
}
|
}
|
||||||
function resize() {
|
function resize() {
|
||||||
|
|
|
@ -292,8 +292,8 @@ pandora.ui.list = function() { // fixme: remove view argument
|
||||||
item = id.split('/')[0], width, height,
|
item = id.split('/')[0], width, height,
|
||||||
$img = $('.OxItem.OxSelected > .OxIcon > img'),
|
$img = $('.OxItem.OxSelected > .OxIcon > img'),
|
||||||
$video = $('.OxItem.OxSelected > .OxIcon > .OxVideoPlayer');
|
$video = $('.OxItem.OxSelected > .OxIcon > .OxVideoPlayer');
|
||||||
pandora.UI.set(['lists', pandora.user.ui.list, 'selected'].join('|'), item);
|
pandora.UI.set('lists|' + pandora.user.ui.list + '|selected', [item]);
|
||||||
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info(data.ids[0].split('/')[0]));
|
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
|
||||||
if ($img.length) {
|
if ($img.length) {
|
||||||
var width = parseInt($img.css('width')),
|
var width = parseInt($img.css('width')),
|
||||||
height = parseInt($img.css('height'));
|
height = parseInt($img.css('height'));
|
||||||
|
@ -333,6 +333,7 @@ pandora.ui.list = function() { // fixme: remove view argument
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
pandora.UI.set('lists|' + pandora.user.ui.list + '|selected', []);
|
||||||
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
|
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
|
||||||
$('.OxSelectedVideo').removeClass('OxSelectedVideo');
|
$('.OxSelectedVideo').removeClass('OxSelectedVideo');
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,14 @@ pandora.ui.viewSelect = function() {
|
||||||
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,
|
||||||
isClipView = pandora.isClipView(view),
|
isClipView = pandora.isClipView(view),
|
||||||
wasClipView = pandora.isClipView(pandora.user.ui.lists[pandora.user.ui.list].listView);
|
wasClipView = pandora.isClipView();
|
||||||
pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), view);
|
pandora.UI.set('lists|' + pandora.user.ui.list + '|listView', view);
|
||||||
pandora.$ui.mainMenu.checkItem('viewMenu_movies_' + view);
|
pandora.$ui.mainMenu.checkItem('viewMenu_movies_' + view);
|
||||||
if (isClipView != 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());
|
||||||
}
|
}
|
||||||
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.list = pandora.ui.list());
|
pandora.URL.set(view + '/' + document.location.search);
|
||||||
pandora.URL.push('/' + view + '/' + document.location.search);
|
|
||||||
// pandora.URL.set('/' + view + '/' + document.location.search);
|
// pandora.URL.set('/' + view + '/' + document.location.search);
|
||||||
} : function(data) {
|
} : function(data) {
|
||||||
var view = data.selected[0].id;
|
var view = data.selected[0].id;
|
||||||
|
|
Loading…
Reference in a new issue