fix #1203 (info doesn't update if item has no video)

This commit is contained in:
rolux 2013-01-31 10:57:35 +05:30
parent 5c5b54c518
commit 90758ca156

View file

@ -32,6 +32,13 @@ pandora.ui.info = function() {
updateInfo(); updateInfo();
function emptyInfo() {
pandora.$ui.listInfo && pandora.$ui.listInfo.remove();
pandora.$ui.posterInfo && pandora.$ui.posterInfo.remove();
pandora.$ui.videoPreview && pandora.$ui.videoPreview.remove();
that.empty();
}
function getId() { function getId() {
return ui.item || ( return ui.item || (
ui.listSelection.length ui.listSelection.length
@ -58,15 +65,15 @@ pandora.ui.info = function() {
previousView = view; previousView = view;
view = getView(); view = getView();
if (view == 'list') { if (view == 'list') {
pandora.$ui.listInfo && pandora.$ui.listInfo.remove(); emptyInfo();
that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo()); that.append(pandora.$ui.listInfo = pandora.ui.listInfo());
previousView == 'video' && resizeInfo(); previousView == 'video' && resizeInfo();
} else if (view == 'poster') { } else if (view == 'poster') {
pandora.api.get({id: id, keys: ['director', 'posterRatio', 'title']}, function(result) { pandora.api.get({id: id, keys: ['director', 'posterRatio', 'title']}, function(result) {
var ratio = result.data.posterRatio, var ratio = result.data.posterRatio,
height = pandora.getInfoHeight(true); height = pandora.getInfoHeight(true);
pandora.$ui.posterInfo && pandora.$ui.posterInfo.remove(); emptyInfo();
that.empty().append( that.append(
pandora.$ui.posterInfo = pandora.ui.posterInfo(Ox.extend(result.data, {id: id})) pandora.$ui.posterInfo = pandora.ui.posterInfo(Ox.extend(result.data, {id: id}))
); );
previousView == 'video' && resizeInfo(); previousView == 'video' && resizeInfo();
@ -76,9 +83,9 @@ pandora.ui.info = function() {
id: id, id: id,
keys: ['duration', 'rendered', 'videoRatio'] keys: ['duration', 'rendered', 'videoRatio']
}, function(result) { }, function(result) {
emptyInfo();
if (result.data && result.data.rendered) { if (result.data && result.data.rendered) {
pandora.$ui.videoPreview && pandora.$ui.videoPreview.remove(); that.append(
that.empty().append(
pandora.$ui.videoPreview = pandora.ui.videoPreview({ pandora.$ui.videoPreview = pandora.ui.videoPreview({
duration: result.data.duration, duration: result.data.duration,
frameRatio: result.data.videoRatio, frameRatio: result.data.videoRatio,