update info views (0xdb, indiancinema, padma)

This commit is contained in:
rolux 2013-05-09 14:03:26 +02:00
parent 3f6d59d5fe
commit f02b8a73ff
3 changed files with 123 additions and 210 deletions

View file

@ -14,8 +14,9 @@ pandora.ui.infoView = function(data) {
MozUserSelect: 'text', MozUserSelect: 'text',
WebkitUserSelect: 'text' WebkitUserSelect: 'text'
}, },
iconRatio = ui.icons == 'posters' iconRatio = ui.icons == 'posters' ? (
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1, ui.showSitePosters ? 5/8 : data.posterRatio
) : 1,
iconSize = ui.infoIconSize, iconSize = ui.infoIconSize,
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio), iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio),
iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio), iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio),
@ -85,7 +86,7 @@ pandora.ui.infoView = function(data) {
left: margin + 'px', left: margin + 'px',
top: margin + iconHeight + 'px', top: margin + iconHeight + 'px',
width: iconSize + 'px', width: iconSize + 'px',
height: iconSize / 2 + 'px', height: Math.round(iconSize / 2) + 'px',
overflow: 'hidden' overflow: 'hidden'
}) })
.appendTo($data.$element), .appendTo($data.$element),
@ -110,7 +111,7 @@ pandora.ui.infoView = function(data) {
.css({ .css({
position: 'absolute', position: 'absolute',
width: iconSize + 'px', width: iconSize + 'px',
height: iconSize / 2 + 'px' height: Math.round(iconSize / 2) + 'px'
}) })
.appendTo($reflection), .appendTo($reflection),
@ -148,7 +149,7 @@ pandora.ui.infoView = function(data) {
marginTop: '-2px' marginTop: '-2px'
}) })
.append( .append(
Ox.Editable({ Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
editable: isEditable, editable: isEditable,
format: function(value) { format: function(value) {
@ -182,7 +183,7 @@ pandora.ui.infoView = function(data) {
marginTop: '2px' marginTop: '2px'
}) })
.append( .append(
Ox.Editable({ Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
editable: isEditable, editable: isEditable,
format: function(value) { format: function(value) {
@ -221,7 +222,7 @@ pandora.ui.infoView = function(data) {
.css({float: 'left'}) .css({float: 'left'})
.html(formatKey(key).replace('</span>', '&nbsp;</span>')) .html(formatKey(key).replace('</span>', '&nbsp;</span>'))
.appendTo($div); .appendTo($div);
Ox.Editable({ Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
format: function(value) { format: function(value) {
return formatValue(value.split(', '), key) return formatValue(value.split(', '), key)
@ -349,9 +350,7 @@ pandora.ui.infoView = function(data) {
data.summary && $('<div>') data.summary && $('<div>')
.css(css) .css(css)
.html( .html(formatKey('summary') + data.summary)
formatKey('summary') + data.summary
)
.appendTo($text); .appendTo($text);
if (canSeeAllMetadata) { if (canSeeAllMetadata) {
@ -556,14 +555,12 @@ pandora.ui.infoView = function(data) {
// Notes ------------------------------------------------------------------- // Notes -------------------------------------------------------------------
if (canEdit) { if (canEdit) {
$('<div>') $('<div>')
.css({marginBottom: '4px'}) .css({marginBottom: '4px'})
.append(formatKey('Notes', true)) .append(formatKey('Notes', true))
.append( .append(
Ox.Editable({ Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
height: 128,
placeholder: formatLight('No notes'), placeholder: formatLight('No notes'),
tooltip: pandora.getEditTooltip(), tooltip: pandora.getEditTooltip(),
type: 'textarea', type: 'textarea',
@ -582,7 +579,6 @@ pandora.ui.infoView = function(data) {
}) })
) )
.appendTo($statistics); .appendTo($statistics);
} }
$('<div>').css({height: '16px'}).appendTo($statistics); $('<div>').css({height: '16px'}).appendTo($statistics);

View file

@ -12,8 +12,9 @@ pandora.ui.infoView = function(data) {
MozUserSelect: 'text', MozUserSelect: 'text',
WebkitUserSelect: 'text' WebkitUserSelect: 'text'
}, },
iconRatio = ui.icons == 'posters' iconRatio = ui.icons == 'posters' ? (
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1, ui.showSitePosters ? 5/8 : data.posterRatio
) : 1,
iconSize = ui.infoIconSize, iconSize = ui.infoIconSize,
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio), iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio),
iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio), iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio),
@ -43,7 +44,7 @@ pandora.ui.infoView = function(data) {
$info = $('<div>') $info = $('<div>')
.css({ .css({
position: 'absolute', position: 'absolute',
left: canEdit && !ui.showIconBrowser ? -listWidth + 'px' : 0, left: 0,
top: 0, top: 0,
right: 0 right: 0
}) })
@ -89,7 +90,7 @@ pandora.ui.infoView = function(data) {
left: margin + 'px', left: margin + 'px',
top: margin + iconHeight + 'px', top: margin + iconHeight + 'px',
width: iconSize + 'px', width: iconSize + 'px',
height: iconSize / 2 + 'px', height: Math.round(iconSize / 2) + 'px',
overflow: 'hidden' overflow: 'hidden'
}) })
.appendTo($data.$element), .appendTo($data.$element),
@ -114,7 +115,7 @@ pandora.ui.infoView = function(data) {
.css({ .css({
position: 'absolute', position: 'absolute',
width: iconSize + 'px', width: iconSize + 'px',
height: iconSize / 2 + 'px' height: Math.round(iconSize / 2) + 'px'
}) })
.appendTo($reflection), .appendTo($reflection),
@ -275,7 +276,7 @@ pandora.ui.infoView = function(data) {
format: function(value) { format: function(value) {
return value.replace( return value.replace(
/<img src=/g, /<img src=/g,
'<img style="max-width: 256px; max-height: 256px; margin: 0 16px 16px 0;float: left;" src=' '<img style="float: left; max-width: 256px; max-height: 256px; margin: 0 16px 16px 0" src='
); );
}, },
placeholder: formatLight('No Summary'), placeholder: formatLight('No Summary'),

View file

@ -3,15 +3,14 @@
pandora.ui.infoView = function(data) { pandora.ui.infoView = function(data) {
var ui = pandora.user.ui, var ui = pandora.user.ui,
descriptions = [],
canEdit = pandora.site.capabilities.canEditMetadata[pandora.user.level] || data.editable, canEdit = pandora.site.capabilities.canEditMetadata[pandora.user.level] || data.editable,
css = { css = {
display: 'inline-block',
marginTop: '4px', marginTop: '4px',
textAlign: 'justify', textAlign: 'justify',
MozUserSelect: 'text', MozUserSelect: 'text',
WebkitUserSelect: 'text' WebkitUserSelect: 'text'
}, },
descriptions = [],
html, html,
iconRatio = ui.icons == 'posters' ? data.posterRatio : 1, iconRatio = ui.icons == 'posters' ? data.posterRatio : 1,
iconSize = ui.infoIconSize, iconSize = ui.infoIconSize,
@ -20,6 +19,8 @@ pandora.ui.infoView = function(data) {
iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0, iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0,
borderRadius = ui.icons == 'posters' ? 0 : iconSize / 8, borderRadius = ui.icons == 'posters' ? 0 : iconSize / 8,
margin = 16, margin = 16,
nameKeys = ['director', 'cinematograper', 'featuring'],
listKeys = nameKeys.concat(['language', 'topic', 'license', 'groups']),
statisticsWidth = 128, statisticsWidth = 128,
uid = Ox.uid(), uid = Ox.uid(),
@ -40,6 +41,9 @@ pandora.ui.infoView = function(data) {
.appendTo(that), .appendTo(that),
$left = Ox.Element() $left = Ox.Element()
.css({
position: 'absolute'
})
.appendTo($info), .appendTo($info),
$icon = Ox.Element({ $icon = Ox.Element({
@ -77,7 +81,7 @@ pandora.ui.infoView = function(data) {
left: margin + 'px', left: margin + 'px',
top: margin + iconHeight + 'px', top: margin + iconHeight + 'px',
width: iconSize + 'px', width: iconSize + 'px',
height: iconSize / 2 + 'px', height: Math.round(iconSize / 2) + 'px',
overflow: 'hidden' overflow: 'hidden'
}) })
.appendTo($left), .appendTo($left),
@ -101,7 +105,7 @@ pandora.ui.infoView = function(data) {
.css({ .css({
position: 'absolute', position: 'absolute',
width: iconSize + 'px', width: iconSize + 'px',
height: iconSize / 2 + 'px' height: Math.round(iconSize / 2) + 'px'
}) })
.appendTo($reflection), .appendTo($reflection),
@ -140,29 +144,22 @@ pandora.ui.infoView = function(data) {
pandora.createLinks($info); pandora.createLinks($info);
} }
var listKeys = [
'language', 'topic', 'director', 'cinematographer', 'featuring',
'groups', 'license'
];
// Source & Project -------------------------------------------------------- // Source & Project --------------------------------------------------------
var count = 0;
['source', 'project'].forEach(function(key) { ['source', 'project'].forEach(function(key) {
$div = $('<div>').appendTo($data);
if (canEdit || data[key]) { if (canEdit || data[key]) {
count && $('<br>').appendTo($div); $div = $('<div>').css(css).css({margin: 0}).appendTo($data);
$('<div>') $('<span>')
.css({float: 'left'})
.html( .html(
formatKey({ formatKey({
category: 'categories', category: 'categories',
}[key] || key).replace('</span>', '&nbsp;</span>') }[key] || key).replace('</span>', '&nbsp;</span>')
) )
.appendTo($div); .appendTo($div);
Ox.Editable({ Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
format: function(value) { format: function(value) {
// FIXME: what??
return listKeys.indexOf(key) >= 0 return listKeys.indexOf(key) >= 0
? formatValue(value.split(', '), { ? formatValue(value.split(', '), {
'director': 'name', 'director': 'name',
@ -171,14 +168,13 @@ pandora.ui.infoView = function(data) {
}[key] || key) }[key] || key)
: value; : value;
}, },
placeholder: formatLight('unknown'), placeholder: formatLight(Ox._('unknown')),
editable: canEdit, editable: canEdit,
tooltip: canEdit ? pandora.getEditTooltip() : '', tooltip: canEdit ? pandora.getEditTooltip() : '',
value: listKeys.indexOf(key) >= 0 value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ') ? (data[key] || []).join(', ')
: data[key] || '' : data[key] || ''
}) })
.css({float: 'left'})
.bindEvent({ .bindEvent({
submit: function(event) { submit: function(event) {
editMetadata(key, event.value); editMetadata(key, event.value);
@ -186,13 +182,18 @@ pandora.ui.infoView = function(data) {
}) })
.appendTo($div); .appendTo($div);
if (canEdit || data[key + 'description']) { if (canEdit || data[key + 'description']) {
$('<br>').css({'clear': 'both'}).appendTo($div);
$('<div>') $('<div>')
.append( .append(
descriptions[key] = Ox.Editable({ descriptions[key] = Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
placeholder: formatLight('No ' + Ox.toTitleCase(key) + ' Description'),
editable: canEdit, editable: canEdit,
format: function(value) {
return value.replace(
/<img src=/g,
'<img style="float: left; max-width: 256px; max-height: 256px; margin: 0 16px 16px 0" src='
);
},
placeholder: formatLight(Ox._('No ' + Ox.toTitleCase(key) + ' Description')),
tooltip: canEdit ? pandora.getEditTooltip() : '', tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea', type: 'textarea',
value: data[key + 'description'] || '' value: data[key + 'description'] || ''
@ -204,11 +205,10 @@ pandora.ui.infoView = function(data) {
} }
}) })
).css({ ).css({
marginTop: '8px', margin: '12px 0',
}) })
.appendTo($div); .appendTo($div);
} }
count++;
} }
}); });
@ -216,17 +216,16 @@ pandora.ui.infoView = function(data) {
$('<div>') $('<div>')
.css({ .css({
marginTop: '-2px', margin: '-2px 0 12px 0',
}) })
.append( .append(
Ox.Editable({ Ox.EditableContent({
editable: canEdit, editable: canEdit,
tooltip: canEdit ? pandora.getEditTooltip() : '', tooltip: canEdit ? pandora.getEditTooltip() : '',
value: data.title value: data.title
}) })
.css({ .css({
display: 'inline-block', //marginBottom: '-3px',
marginBottom: '-3px',
fontWeight: 'bold', fontWeight: 'bold',
fontSize: '13px', fontSize: '13px',
MozUserSelect: 'text', MozUserSelect: 'text',
@ -240,139 +239,37 @@ pandora.ui.infoView = function(data) {
) )
.appendTo($center); .appendTo($center);
// Location, Date, Language and Duration ----------------------------------- // Groups ------------------------------------------------------------------
if (canEdit) { renderGroup(['location', 'date', 'language']);
$div = $('<div>').css(css).css({marginTop: '12px'}).appendTo($center);
['location', 'date', 'language', 'duration'].forEach(function(key, i) {
i && $('<div>').css({float: 'left'}).html(';&nbsp;').appendTo($div);
$('<div>')
.css({float: 'left'})
.html(formatKey(key).replace('</span>', '&nbsp;</span>'))
.appendTo($div);
Ox.Editable({
clickLink: pandora.clickLink,
editable: key != 'duration',
format: function(value) {
return formatValue(listKeys.indexOf(key) >= 0
? value.split(', ') : value, key);
},
placeholder: formatLight('unknown'),
tooltip: pandora.getEditTooltip(),
value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
})
.css({float: 'left'})
.bindEvent({
submit: function(event) {
editMetadata(key, event.value);
}
})
.appendTo($div);
});
} else {
html = [];
['location', 'date', 'language', 'duration'].forEach(function(key) {
if (data[key]) {
html.push(formatKey(key) + formatValue(data[key], key));
}
});
$('<div>').css(css).html(html.join('; ')).appendTo($center);
}
// Director, Cinematographer and Featuring --------------------------------- renderGroup(['director', 'cinematographer', 'featuring']);
if (canEdit) { renderGroup(['topics']);
$div = $('<div>').css(css).appendTo($center);
['director', 'cinematographer', 'featuring'].forEach(function(key, i) {
i && $('<div>').css({float: 'left'}).html(';&nbsp;').appendTo($div);
$('<div>')
.css({float: 'left'})
.html(formatKey(key).replace('</span>', '&nbsp;</span>'))
.appendTo($div);
Ox.Editable({
clickLink: pandora.clickLink,
format: function(value) {
return formatValue(value.split(', '), 'name');
},
placeholder: formatLight('unknown'),
tooltip: pandora.getEditTooltip(),
value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
})
.css({float: 'left'})
.bindEvent({
submit: function(event) {
editMetadata(key, event.value);
}
})
.appendTo($div);
});
} else if (data.director || data.cinematographer || data.featuring) {
html = [];
['director', 'cinematographer', 'featuring'].forEach(function(key) {
if (data[key] && data[key].length) {
html.push(
formatKey(key)
+ formatValue(data[key], key)
);
}
});
$('<div>').css(css).html(html.join('; ')).appendTo($center);
}
// Topic -------------------------------------------------------------------
if (canEdit) {
var key = 'topic';
$div = $('<div>').css(css).appendTo($center);
$('<div>')
.css({float: 'left'})
.html(formatKey('Topics').replace('</span>', '&nbsp;</span>'))
.appendTo($div);
Ox.Editable({
clickLink: pandora.clickLink,
format: function(value) {
return formatValue(value.split(', '), key);
},
placeholder: formatLight('unknown'),
tooltip: pandora.getEditTooltip(),
value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
})
.css({float: 'left'})
.bindEvent({
submit: function(event) {
editMetadata(key, event.value);
}
})
.appendTo($div);
} else if (data.topic) {
html = formatKey('topics') + formatValue(data.topic, 'topic');
$('<div>').css(css).html(html).appendTo($center);
}
// Summary ------------------------------------------------------------- // Summary -------------------------------------------------------------
if (canEdit) { if (canEdit || data.summary) {
$('<div>') $('<div>')
.append( .append(
Ox.Editable({ Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
editable: canEdit, editable: canEdit,
format: function(value) {
return value.replace(
/<img src=/g,
'<img style="float: left; max-width: 256px; max-height: 256px; margin: 0 16px 16px 0" src='
);
},
maxHeight: Infinity, maxHeight: Infinity,
placeholder: formatLight('No Summary'), placeholder: formatLight(Ox._('No Summary')),
tooltip: canEdit ? pandora.getEditTooltip() : '', tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea', type: 'textarea',
value: data.summary || '' value: data.summary || ''
}) })
.css(css) .css(css)
// 8px marginTop gets duplicated in the editable, result is 16px // margin gets doubled in the editable -- does it?
.css({marginTop: '8px'}) .css({margin: '16px 0 12px 0'})
.bindEvent({ .bindEvent({
submit: function(event) { submit: function(event) {
editMetadata('summary', event.value); editMetadata('summary', event.value);
@ -380,35 +277,12 @@ pandora.ui.infoView = function(data) {
}) })
) )
.appendTo($center); .appendTo($center);
} else if (data.summary) { $('<div>').css({width: '1px', height: 0, clear: 'both'}).appendTo($center);
$('<div>').css(css).css({marginTop: '16px'}).html(data.summary).appendTo($center);
} }
// License ----------------------------------------------------------------- // License -----------------------------------------------------------------
$div = $('<div>').css(css).css({marginTop: '16px'}).appendTo($center); renderGroup(['license']);
if (canEdit) {
$('<div>')
.css({float: 'left'})
.html(formatKey('license').replace('</span>', '&nbsp;</span>'))
.appendTo($div);
Ox.Editable({
placeholder: formatLight('No License'),
tooltip: pandora.getEditTooltip(),
value: (data.license || []).join(', ')
})
.bindEvent({
submit: function(event) {
editMetadata('license', event.value);
}
})
.appendTo($div);
} else if (data.license) {
$div.html(
formatKey('License')
+ (data.license || []).join(', ')
);
}
// Space ------------------------------------------------------------------- // Space -------------------------------------------------------------------
@ -470,7 +344,7 @@ pandora.ui.infoView = function(data) {
.css({margin: '2px 0 0 -1px'}) // fixme: weird .css({margin: '2px 0 0 -1px'}) // fixme: weird
.append( .append(
Ox.Editable({ Ox.Editable({
placeholder: key == 'groups' ? formatLight('No Groups') : '', placeholder: key == 'groups' ? formatLight(Ox._('No Groups')) : '',
editable: canEdit, editable: canEdit,
tooltip: canEdit ? pandora.getEditTooltip() : '', tooltip: canEdit ? pandora.getEditTooltip() : '',
value: key == 'user' ? data[key] : data[key].join(', ') value: key == 'user' ? data[key] : data[key].join(', ')
@ -512,14 +386,13 @@ pandora.ui.infoView = function(data) {
// Notes -------------------------------------------------------------------- // Notes --------------------------------------------------------------------
if (canEdit) { if (canEdit) {
$('<div>') $('<div>')
.css({marginBottom: '4px'}) .css({marginBottom: '4px'})
.append(formatKey('Notes', true)) .append(formatKey('Notes', true))
.append( .append(
Ox.Editable({ Ox.EditableContent({
height: 128, height: 128,
placeholder: formatLight('No notes'), placeholder: formatLight(Ox._('No notes')),
tooltip: pandora.getEditTooltip(), tooltip: pandora.getEditTooltip(),
type: 'textarea', type: 'textarea',
value: data.notes || '', value: data.notes || '',
@ -532,7 +405,6 @@ pandora.ui.infoView = function(data) {
}) })
) )
.appendTo($right); .appendTo($right);
} }
$('<div>').css({height: '16px'}).appendTo($right); $('<div>').css({height: '16px'}).appendTo($right);
@ -552,7 +424,6 @@ pandora.ui.infoView = function(data) {
descriptions[key] && descriptions[key].options({ descriptions[key] && descriptions[key].options({
value: result.data[key + 'description'] value: result.data[key + 'description']
}); });
Ox.Request.clearCache(); // fixme: too much? can change filter/list etc Ox.Request.clearCache(); // fixme: too much? can change filter/list etc
if (result.data.id != data.id) { if (result.data.id != data.id) {
pandora.UI.set({item: result.data.id}); pandora.UI.set({item: result.data.id});
@ -579,25 +450,19 @@ pandora.ui.infoView = function(data) {
function formatKey(key, isStatistics) { function formatKey(key, isStatistics) {
var item = Ox.getObjectById(pandora.site.itemKeys, key); var item = Ox.getObjectById(pandora.site.itemKeys, key);
key = item ? item.title : key; key = Ox._(item ? item.title : key);
return isStatistics return isStatistics
? $('<div>').css({marginBottom: '4px', fontWeight: 'bold'}) ? $('<div>').css({marginBottom: '4px', fontWeight: 'bold'})
.html(Ox.toTitleCase(key).replace(' Per ', ' per ')) .html(Ox._(Ox.toTitleCase(key).replace(' Per ', ' per ')))
: '<span style="font-weight: bold">' + Ox.toTitleCase(key) + ':</span> '; : '<span style="font-weight: bold">' + Ox._(Ox.toTitleCase(key))
+ ':</span> ';
} }
function formatLight(str) { function formatLight(str) {
return '<span style="color: rgb(128, 128, 128)">' + str + '</span>'; return '<span style="color: rgb(128, 128, 128)">' + str + '</span>';
} }
function formatValue(value, key) { function formatLink(value, key) {
if (key == 'date') {
return value ? Ox.formatDate(value,
['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length]
) : '';
} else if (key == 'duration') {
return value < 60 ? Math.round(value) + ' sec' : Math.round(value / 60) + ' min';
}
return (Ox.isArray(value) ? value : [value]).map(function(value) { return (Ox.isArray(value) ? value : [value]).map(function(value) {
return key ? return key ?
'<a href="/' + key + '==' + value + '">' + value + '</a>' '<a href="/' + key + '==' + value + '">' + value + '</a>'
@ -605,6 +470,18 @@ pandora.ui.infoView = function(data) {
}).join(', '); }).join(', ');
} }
function formatValue(value, key) {
var ret;
if (key == 'date') {
ret = value ? Ox.formatDate(value,
['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length]
) : '';
} else {
ret = value;
}
return formatLink(ret, key);
}
function getRightsLevelElement(rightsLevel) { function getRightsLevelElement(rightsLevel) {
return Ox.Theme.formatColorLevel( return Ox.Theme.formatColorLevel(
rightsLevel, rightsLevel,
@ -614,6 +491,12 @@ pandora.ui.infoView = function(data) {
); );
} }
function getValue(key, value) {
return !value ? ''
: Ox.contains(listKeys, key) ? value.join(', ')
: value;
}
function renderCapabilities(rightsLevel) { function renderCapabilities(rightsLevel) {
var capabilities = [].concat( var capabilities = [].concat(
canEdit ? [{name: 'canSeeItem', symbol: 'Find'}] : [], canEdit ? [{name: 'canSeeItem', symbol: 'Find'}] : [],
@ -674,8 +557,8 @@ pandora.ui.infoView = function(data) {
}); });
if (!canEdit) { if (!canEdit) {
Ox.Button({ Ox.Button({
title: 'Help', title: Ox._('Help'),
tooltip: 'About Rights', tooltip: Ox._('About Rights'),
type: 'image' type: 'image'
}) })
.css({marginLeft: '52px'}) .css({marginLeft: '52px'})
@ -689,6 +572,39 @@ pandora.ui.infoView = function(data) {
}); });
} }
function renderGroup(keys) {
var $element;
if (canEdit || keys.filter(function(key) {
return data[key];
}).length) {
$element = $('<div>').css(css);
keys.forEach(function(key, i) {
if (canEdit || data[key]) {
if ($element.children().length) {
$('<span>').html('; ').appendTo($element);
}
$('<span>').html(formatKey(key)).appendTo($element);
Ox.EditableContent({
clickLink: pandora.clickLink,
format: function(value) {
return formatValue(value, key);
},
placeholder: formatLight('unknown'),
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: getValue(key, data[key])
})
.bindEvent({
submit: function(data) {
editMetadata(key, data.value);
}
})
.appendTo($element);
}
});
$element.appendTo($center);
}
}
function renderRightsLevel() { function renderRightsLevel() {
var $rightsLevelElement = getRightsLevelElement(data.rightslevel), var $rightsLevelElement = getRightsLevelElement(data.rightslevel),
$rightsLevelSelect; $rightsLevelSelect;
@ -696,7 +612,7 @@ pandora.ui.infoView = function(data) {
if (canEdit) { if (canEdit) {
$rightsLevelSelect = Ox.Select({ $rightsLevelSelect = Ox.Select({
items: pandora.site.rightsLevels.map(function(rightsLevel, i) { items: pandora.site.rightsLevels.map(function(rightsLevel, i) {
return {id: i, title: rightsLevel.name}; return {id: i, title: Ox._(rightsLevel.name)};
}), }),
width: 128, width: 128,
value: data.rightslevel value: data.rightslevel
@ -771,8 +687,8 @@ pandora.ui.infoView = function(data) {
that.reload = function() { that.reload = function() {
var src = src = '/' + data.id + '/' + ( var src = src = '/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon' ui.icons == 'posters' ? 'poster' : 'icon'
) + '512.jpg?' + Ox.uid(); ) + '512.jpg?' + Ox.uid();
$icon.attr({src: src}); $icon.attr({src: src});
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;