icma infoview cleanup

This commit is contained in:
j 2017-01-25 21:49:10 +01:00
parent 35eb3fdc0c
commit b50fc23a75

View file

@ -385,7 +385,7 @@ pandora.ui.infoView = function(data) {
'screenplay', 'screenplay',
'dialogue', 'dialogue',
'adaptation' 'adaptation'
]); ]).css({marginTop: '12px'});
renderGroup([ renderGroup([
'musicdirector', 'musicdirector',
'backgroundmusic', 'backgroundmusic',
@ -417,8 +417,6 @@ pandora.ui.infoView = function(data) {
]); ]);
renderGroup([ renderGroup([
'courtesy', 'courtesy',
]);
renderGroup([
'subtitledby', 'subtitledby',
'annotatedby', 'annotatedby',
]); ]);
@ -462,8 +460,41 @@ pandora.ui.infoView = function(data) {
$('<div>').css({height: '16px'}).appendTo($text); $('<div>').css({height: '16px'}).appendTo($text);
// Documents ---------------------------------------------------------------
var $div = $('<div>')
.css({marginBottom: '4px'})
.append(formatKey(
'Documents', 'link', '/' + data['id'] + '/documents'
))
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(Ox.formatNumber(data.numberofdocuments || 0))
)
.appendTo($statistics);
pandora.createLinks($div);
if (data.parts && data.rendered) { if (data.parts && data.rendered) {
// Duration, Aspect Ratio --------------------------------------------------
// Annotations ---------------------------------------------------------
$div = $('<div>')
.css({marginBottom: '4px'})
.append(formatKey(
'Annotations', 'link', '/' + data['id'] + '/' + ui.videoView
))
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(Ox.formatNumber(data.numberofannotations || 0))
)
.appendTo($statistics);
pandora.createLinks($div);
// Duration, Aspect Ratio ----------------------------------------------
['duration', 'aspectratio'].forEach(function(key) { ['duration', 'aspectratio'].forEach(function(key) {
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key), var itemKey = Ox.getObjectById(pandora.site.itemKeys, key),
@ -482,7 +513,7 @@ pandora.ui.infoView = function(data) {
.appendTo($statistics); .appendTo($statistics);
}); });
// Hue, Saturation, Lightness, Volume -------------------------------------- // Hue, Saturation, Lightness, Volume ----------------------------------
['hue', 'saturation', 'lightness', 'volume'].forEach(function(key) { ['hue', 'saturation', 'lightness', 'volume'].forEach(function(key) {
var value = data[key] || 0; var value = data[key] || 0;
@ -496,7 +527,7 @@ pandora.ui.infoView = function(data) {
.appendTo($statistics); .appendTo($statistics);
}); });
// Cuts per Minute, Words per Minute --------------------------------------- // Cuts per Minute, Words per Minute -----------------------------------
['cutsperminute', 'wordsperminute'].forEach(function(key) { ['cutsperminute', 'wordsperminute'].forEach(function(key) {
var value = data[key] || 0; var value = data[key] || 0;
@ -513,47 +544,19 @@ pandora.ui.infoView = function(data) {
.appendTo($statistics); .appendTo($statistics);
}); });
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey('Annotations', 'statistics'))
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(Ox.formatNumber(data.numberofannotations || 0))
)
.appendTo($statistics);
} else { } else {
// no video placeholder // no video placeholder
} }
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey('Documents', 'statistics'))
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(Ox.formatNumber(data.numberofdocuments || 0))
)
.on({
click: function() {
if (data.numberofdocuments) {
pandora.UI.set({
itemView: 'documents'
});
}
}
})
.appendTo($statistics);
// Rights Level ------------------------------------------------------------ // Rights Level ------------------------------------------------------------
var $rightsLevel = $('<div>'); var $rightsLevel = $('<div>');
$('<div>') var $div = $('<div>')
.css({marginBottom: '4px'}) .css({marginBottom: '4px'})
.append(formatKey('Rights Level', 'statistics')) .append(formatKey('Rights Level', 'link', '/copyrights'))
.append($rightsLevel) .append($rightsLevel)
.appendTo($statistics); .appendTo($statistics);
pandora.createLinks($div);
renderRightsLevel(); renderRightsLevel();
// Comments ---------------------------------------------------------------- // Comments ----------------------------------------------------------------
@ -653,7 +656,7 @@ pandora.ui.infoView = function(data) {
} }
} }
function formatKey(key, mode) { function formatKey(key, mode, link) {
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';
@ -664,13 +667,20 @@ pandora.ui.infoView = function(data) {
} else if (key == 'keyword') { } else if (key == 'keyword') {
key = 'keywords' key = 'keywords'
} }
var value = Ox.toTitleCase(key)
.replace(' Of ', ' of ')
.replace(' Per ', ' per ')
return mode == 'text' return mode == 'text'
? '<span style="font-weight: bold">' + Ox.toTitleCase(key) + ':</span> ' ? '<span style="font-weight: bold">' + value + ':</span> '
: mode == 'description' : mode == 'description'
? Ox.toTitleCase(key) ? value
: mode == 'link'
? Ox.Element()
.css({marginBottom: '4px', fontWeight: 'bold'})
.html('<a href="' + link + '">' + value + '</a>')
: Ox.Element() : Ox.Element()
.css({marginBottom: '4px', fontWeight: 'bold'}) .css({marginBottom: '4px', fontWeight: 'bold'})
.html(Ox.toTitleCase(key).replace(' Per ', ' per ')); .html(value);
} }
function formatLight(str) { function formatLight(str) {
@ -1077,6 +1087,7 @@ pandora.ui.infoView = function(data) {
}); });
$element.appendTo($text); $element.appendTo($text);
} }
return $element;
} }
function renderRightsLevel() { function renderRightsLevel() {
@ -1109,7 +1120,7 @@ pandora.ui.infoView = function(data) {
$rightsLevelSelect $rightsLevelSelect
.css({background: $rightsLevelElement.css('background')}) .css({background: $rightsLevelElement.css('background')})
.data({OxColor: $rightsLevelElement.data('OxColor')}) .data({OxColor: $rightsLevelElement.data('OxColor')})
renderCapabilities(rightsLevel); // renderCapabilities(rightsLevel);
pandora.api.edit({id: data.id, rightslevel: rightsLevel}, function(result) { pandora.api.edit({id: data.id, rightslevel: rightsLevel}, function(result) {
// ... // ...
}); });
@ -1123,10 +1134,12 @@ pandora.ui.infoView = function(data) {
}) })
.appendTo($rightsLevel); .appendTo($rightsLevel);
} }
/*
if (data.parts) { if (data.parts) {
$capabilities = $('<div>').appendTo($rightsLevel); $capabilities = $('<div>').appendTo($rightsLevel);
renderCapabilities(data.rightslevel); renderCapabilities(data.rightslevel);
} }
*/
} }
function toggleIconSize() { function toggleIconSize() {