alternative titles

This commit is contained in:
j 2019-11-20 15:24:14 +01:00
parent 3b765c4a98
commit 7da2b8d943
1 changed files with 24 additions and 2 deletions

View File

@ -30,7 +30,7 @@ pandora.ui.infoView = function(data, isMixed) {
}).map(function(key){
return key.id;
}),
specialListKeys = [].concat(
specialListKeys = ['alternativeTitles'].concat(
pandora.site.itemKeys.filter(function(key) {
return key.type[0] == 'date'
}).map(function(key) {
@ -217,6 +217,8 @@ pandora.ui.infoView = function(data, isMixed) {
})
.appendTo($info),
$alternativeTitles,
$statistics = $('<div>')
.css({
position: 'absolute',
@ -271,8 +273,11 @@ pandora.ui.infoView = function(data, isMixed) {
)
.appendTo($text);
renderGroup(['alternativeTitles']);
// Director, Year and Country, Language --------------------------------
renderGroup(['director', 'year', 'country', 'language']);
// Featuring ----------------------------------------------
@ -417,6 +422,12 @@ pandora.ui.infoView = function(data, isMixed) {
var edit = {id: isMultiple ? ui.listSelection : data.id};
if (key == 'title') {
edit[key] = value;
if (key == 'alternativeTitles') {
edit[key] = value ? Ox.decodeHTMLEntities(value).split('; ').map(function(value) {
return [Ox.encodeHTMLEntities(value), []];
}) : [];
data[key] = edit[key];
$alternativeTitles.html(formatKey(key));
} else if (listKeys.indexOf(key) >= 0) {
edit[key] = value ? value.split(', ') : [];
} else if (specialListKeys.indexOf(key) > -1) {
@ -466,6 +477,11 @@ pandora.ui.infoView = function(data, isMixed) {
var item = Ox.getObjectById(pandora.site.itemKeys, key);
key = Ox._(item ? item.title : key);
mode = mode || 'text';
if (key == 'alternativeTitles') {
key = Ox._('Alternative Title' + (
data.alternativeTitles && data.alternativeTitles.length == 1 ? '' : 's'
));
}
return mode == 'text'
? '<span style="font-weight: bold">' + Ox.toTitleCase(key) + ':</span> '
: mode == 'description'
@ -625,7 +641,13 @@ pandora.ui.infoView = function(data, isMixed) {
if ($element.children().length) {
$('<span>').html('; ').appendTo($element);
}
$('<span>').html(formatKey(key)).appendTo($element);
if (key == 'alternativeTitles') {
$alternativeTitles = $('<span>')
.html(formatKey(key))
.appendTo($element);
} else {
$('<span>').html(formatKey(key)).appendTo($element);
}
Ox.EditableContent({
clickLink: pandora.clickLink,
format: function(value) {