fix formatting of the info line of movie browser icons

This commit is contained in:
rolux 2011-10-13 12:24:13 +00:00
parent db42f6b2e3
commit a0fd292035
2 changed files with 23 additions and 12 deletions

View file

@ -53,19 +53,31 @@ pandora.ui.browser = function() {
draggable: true, draggable: true,
id: 'list', id: 'list',
item: function(data, sort, size) { item: function(data, sort, size) {
size = size || 64;
var ui = pandora.user.ui, var ui = pandora.user.ui,
ratio = ui.icons == 'posters' ratio = ui.icons == 'posters'
? (ui.showSitePoster ? 5/8 : data.posterRatio) : 1, ? (ui.showSitePoster ? 5/8 : data.posterRatio) : 1,
size = size || 64; url = '/' + data.id + '/' + (
return {
height: ratio <= 1 ? size : size / ratio,
id: data.id,
info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key],
title: data.title + (data.director ? ' (' + data.director + ')' : ''),
url: '/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePoster ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePoster ? 'siteposter' : 'poster') : 'icon'
) + size + '.jpg', ) + size + '.jpg',
format, info, sortKey;
if (['title', 'director'].indexOf(sortKey) > -1) {
info = data['year'];
} else {
sortKey = sort[0].key;
format = pandora.getSortKeyData(sortKey).format;
info = format
? Ox['format' + Ox.toTitleCase(format.type)]
.apply(this, Ox.merge([data[sortKey]], format.args || []))
: data[sortKey];
}
return {
height: ratio <= 1 ? size : size / ratio,
id: data.id,
info: info,
title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
url: url,
width: ratio >= 1 ? size : size * ratio width: ratio >= 1 ? size : size * ratio
}; };
}, },

View file

@ -149,13 +149,12 @@ pandora.ui.list = function() {
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePoster ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePoster ? 'siteposter' : 'poster') : 'icon'
) + size + '.jpg', ) + size + '.jpg',
sortKey = sort[0].key, format, info, sortKey;
format, info;
if (['title', 'director'].indexOf(sortKey) > -1) { if (['title', 'director'].indexOf(sortKey) > -1) {
info = data['year']; info = data['year'];
} else { } else {
sortKey = sort[0].key, sortKey = sort[0].key;
format = pandora.getSortKeyData(sortKey).format, format = pandora.getSortKeyData(sortKey).format;
info = format info = format
? Ox['format' + Ox.toTitleCase(format.type)] ? Ox['format' + Ox.toTitleCase(format.type)]
.apply(this, Ox.merge([data[sortKey]], format.args || [])) .apply(this, Ox.merge([data[sortKey]], format.args || []))