metadata dialog: cosmetic changes

This commit is contained in:
rolux 2013-02-28 14:10:35 +05:30
parent 97d1c337f8
commit 1f800c0361

View file

@ -191,10 +191,27 @@ pandora.ui.metadataDialog = function(data) {
}); });
} }
function getMetadata(id, callback) { function formatValue(key, value) {
return !value ? ''
: key == 'alternativeTitles' ? value.map(function(v) {
return v[0];
}).join('; ')
: key == 'runtime' ? Math.round(value / 60) + ' min'
: Ox.isArray(
Ox.getObjectById(pandora.site.itemKeys, key).type
) ? value.join(', ')
: value;
}
function getFormWidth() {
return dialogWidth - 32 - Ox.UI.SCROLLBAR_SIZE;
}
function getMetadata() {
pandora.api.getMetadata({id: data.imdbId, keys: keys.concat(['originalTitle'])}, function(result) { pandora.api.getMetadata({id: data.imdbId, keys: keys.concat(['originalTitle'])}, function(result) {
var $bar = Ox.Bar({size: 24}), var $bar = Ox.Bar({size: 24}),
$data = Ox.Element().css({padding: '12px', overflowY: 'auto'}), $data = Ox.Element()
.css({padding: '12px', overflowY: 'auto'}),
$content = Ox.SplitPanel({ $content = Ox.SplitPanel({
elements: [ elements: [
{element: $bar, size: 24}, {element: $bar, size: 24},
@ -284,7 +301,7 @@ pandora.ui.metadataDialog = function(data) {
.appendTo($data); .appendTo($data);
}); });
}); });
that.options({content: $content}) that.options({content: $content});
updateKeys = getUpdateKeys(); updateKeys = getUpdateKeys();
updateButtons(); updateButtons();
} else { } else {
@ -293,22 +310,6 @@ pandora.ui.metadataDialog = function(data) {
}); });
} }
function formatValue(key, value) {
return !value ? ''
: key == 'alternativeTitles' ? value.map(function(v) {
return v[0];
}).join('; ')
: key == 'runtime' ? Math.round(value / 60) + ' min'
: Ox.isArray(
Ox.getObjectById(pandora.site.itemKeys, key).type
) ? value.join(', ')
: value;
}
function getFormWidth() {
return dialogWidth - 32 - Ox.UI.SCROLLBAR_SIZE;
}
function getTitle(key) { function getTitle(key) {
return key == 'alternativeTitles' ? 'Alternative Titles' return key == 'alternativeTitles' ? 'Alternative Titles'
: Ox.getObjectById(pandora.site.itemKeys, key).title; : Ox.getObjectById(pandora.site.itemKeys, key).title;