alternative titles

This commit is contained in:
j 2019-11-20 15:24:14 +01:00
parent 3b765c4a98
commit 7da2b8d943

View file

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