hide some metadata from guests

This commit is contained in:
rolux 2013-03-07 10:46:16 +00:00
parent 34be7923a7
commit 62c33ef2a4

View file

@ -7,6 +7,7 @@ pandora.ui.infoView = function(data) {
var ui = pandora.user.ui,
canEdit = pandora.site.capabilities.canEditMetadata[pandora.user.level],
canSeeAllMetadata = pandora.user.level != 'guest',
css = {
marginTop: '4px',
textAlign: 'justify',
@ -262,8 +263,11 @@ pandora.ui.infoView = function(data) {
.html(
formatKey('Alternative Title' + (data.alternativeTitles.length == 1 ? '' : 's'))
+ data.alternativeTitles.map(function(value) {
return value[0] + (Ox.isArray(value[1]) ? ' '
+ formatLight('(' + value[1].join(', ') + ')') : '');
return value[0] + (
canSeeAllMetadata && Ox.isArray(value[1])
? ' ' + formatLight('(' + value[1].join(', ') + ')')
: ''
);
}).join(', ')
)
.appendTo($text);
@ -319,19 +323,21 @@ pandora.ui.infoView = function(data) {
// FIXME: 'uncredited' should be removed on the backend
value.character = value.character.replace('(uncredited)', '').trim();
return formatValue(value.actor, 'name')
+ (value.character ? ' '
+ formatLight('(' + formatValue(value.character) + ')')
: '');
+ (
canSeeAllMetadata && value.character
? ' ' + formatLight('(' + formatValue(value.character) + ')')
: ''
);
}).join(', ')
)
.appendTo($text);
if (data.genre || data.keyword) {
if (data.genre || (data.keyword && canSeeAllMetadata)) {
$div = $('<div>')
.css(css)
.appendTo($text);
html = [];
['genre', 'keyword'].forEach(function(key) {
(canSeeAllMetadata ? ['genre', 'keyword'] : ['genre']).forEach(function(key) {
data[key] && html.push(
formatKey(key == 'keyword' ? 'keywords' : key)
+ formatValue(data[key], key)
@ -347,6 +353,8 @@ pandora.ui.infoView = function(data) {
)
.appendTo($text);
if (canSeeAllMetadata) {
data.trivia && data.trivia.forEach(function(value) {
$('<div>')
.css({
@ -439,6 +447,8 @@ pandora.ui.infoView = function(data) {
$div.html(html.join('; '));
}
}
['reviews', 'links'].forEach(function(key) {
data[key] && $('<div>')
.css(css)