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