forked from 0x2620/pandora
update filmographies
This commit is contained in:
parent
ec30110ac9
commit
4ea2328fe5
1 changed files with 11 additions and 5 deletions
|
@ -578,7 +578,7 @@ pandora.ui.infoView = function(data) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
function getFilmography(key, value, callback) {
|
||||
function getFilmography(key, value, roles, callback) {
|
||||
var keys = ['id', 'title', 'year'].concat(
|
||||
key == 'name' ? nameKeys : []
|
||||
);
|
||||
|
@ -601,12 +601,17 @@ pandora.ui.infoView = function(data) {
|
|||
result.data.items.forEach(function(item) {
|
||||
var year = item.year || 'Unknown Year';
|
||||
if (key == 'name') {
|
||||
item.role = nameKeys.filter(function(nameKey) {
|
||||
item.roles = nameKeys.filter(function(nameKey) {
|
||||
return Ox.contains(item[nameKey], value);
|
||||
}).map(function(nameKey) {
|
||||
});
|
||||
if (roles.length == 1 && Ox.isEqual(item.roles, roles)) {
|
||||
delete item.roles;
|
||||
} else {
|
||||
item.roles = item.roles.map(function(nameKey) {
|
||||
return Ox.getObjectById(pandora.site.itemKeys, nameKey).title;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!items[year]) {
|
||||
items[year] = [];
|
||||
}
|
||||
|
@ -617,7 +622,7 @@ pandora.ui.infoView = function(data) {
|
|||
Object.keys(items).sort().map(function(year) {
|
||||
return '<b>' + year + ':</b> ' + items[year].map(function(item) {
|
||||
return '<a href="/' + item.id + '">' + item.title + '</a>'
|
||||
+ (item.role ? ' (' + item.role.join(', ') + ')' : '');
|
||||
+ (item.roles ? ' (' + item.roles.join(', ') + ')' : '');
|
||||
}).join(', ');
|
||||
}).join(', ')
|
||||
);
|
||||
|
@ -792,6 +797,7 @@ pandora.ui.infoView = function(data) {
|
|||
getFilmography(
|
||||
key == 'studios' ? 'productionCompany' : 'name',
|
||||
value.name,
|
||||
value.keys,
|
||||
function($element) {
|
||||
$link.addClass('OxLink')
|
||||
.html('Hide ' + filmography)
|
||||
|
|
Loading…
Reference in a new issue