fix special (semicolon-separated) values

This commit is contained in:
rolux 2013-03-08 08:12:10 +00:00
parent 169c9c6919
commit 0ef9742d0e

View file

@ -26,9 +26,10 @@ pandora.ui.infoView = function(data) {
'editor', 'composer', 'lyricist', 'actor' 'editor', 'composer', 'lyricist', 'actor'
], ],
listKeys = nameKeys.concat([ listKeys = nameKeys.concat([
'country', 'language', 'color', 'sound', 'productionCompany', 'country', 'language', 'color', 'sound', 'genre', 'keyword'
'genre', 'keyword'
]), ]),
// these may contain commas, and are thus separated by semicolons
specialListKeys = ['alternativeTitles', 'productionCompany'],
descriptions = { descriptions = {
names: getNames(), names: getNames(),
studios: getStudios() studios: getStudios()
@ -458,6 +459,8 @@ pandora.ui.infoView = function(data) {
$minutes[value ? 'show' : 'hide'](); $minutes[value ? 'show' : 'hide']();
} else if (listKeys.indexOf(key) > -1) { } else if (listKeys.indexOf(key) > -1) {
edit[key] = value ? value.split(', ') : []; edit[key] = value ? value.split(', ') : [];
} else if (specialListKeys.indexOf(key) > -1) {
edit[key] = value ? value.split('; ') : [];
} else { } else {
edit[key] = value; edit[key] = value;
} }
@ -527,7 +530,7 @@ pandora.ui.infoView = function(data) {
return key return key
? '<a href="/' + key + '=' + value + '">' + value + '</a>' ? '<a href="/' + key + '=' + value + '">' + value + '</a>'
: value; : value;
}).join(', '); }).join(Ox.contains(specialListKeys, key) ? '; ' : ', ');
} }
function formatTitle(title) { function formatTitle(title) {
@ -547,11 +550,10 @@ pandora.ui.infoView = function(data) {
var ret; var ret;
if (nameKeys.indexOf(key) > -1) { if (nameKeys.indexOf(key) > -1) {
ret = formatLink(value.split(', '), 'name'); ret = formatLink(value.split(', '), 'name');
} else if ( } else if (listKeys.indexOf(key) > -1) {
listKeys.indexOf(key) > -1
|| Ox.contains(['year', 'color', 'sound'], key)
) {
ret = formatLink(value.split(', '), key); ret = formatLink(value.split(', '), key);
} else if (specialListKeys.indexOf(key) > -1) {
ret = formatLink(value.split('; '), key);
} else if (key == 'imdbId') { } else if (key == 'imdbId') {
ret = '<a href="http://www.imdb.com/title/tt' ret = '<a href="http://www.imdb.com/title/tt'
+ value + '">' + value + '</a>'; + value + '">' + value + '</a>';
@ -616,6 +618,7 @@ pandora.ui.infoView = function(data) {
}).join('; ') }).join('; ')
: key == 'runtime' ? Math.round(value / 60) : key == 'runtime' ? Math.round(value / 60)
: Ox.contains(listKeys, key) ? value.join(', ') : Ox.contains(listKeys, key) ? value.join(', ')
: Ox.contains(specialListKeys, key) ? value.join('; ')
: value; : value;
} }