add comments field

This commit is contained in:
rlx 2019-06-24 15:21:59 +02:00
parent f96c0b720f
commit ab1578158d

View file

@ -368,6 +368,41 @@ pandora.ui.documentInfoView = function(data, isMixed) {
.appendTo($statistics); .appendTo($statistics);
renderRightsLevel(); renderRightsLevel();
// Comments ----------------------------------------------------------------
if (canEdit) {
$('<div>')
.css({marginBottom: '4px'})
.append(
formatKey('Comments', 'statistics').options({
tooltip: Ox._('Only {0} can see and edit these comments', [
Object.keys(pandora.site.capabilities.canEditMetadata).map(function(level, i) {
return (
i == 0 ? ''
: i < Ox.len(pandora.site.capabilities.canEditMetadata) - 1 ? ', '
: ' ' + Ox._('and') + ' '
) + Ox.toTitleCase(level)
}).join('')])
})
)
.append(
Ox.EditableContent({
height: 128,
placeholder: formatLight(Ox._(isMixed ? 'Mixed comments' : 'No comments')),
tooltip: pandora.getEditTooltip(),
type: 'textarea',
value: data.comments || '',
width: 128
})
.bindEvent({
submit: function(event) {
editMetadata('comments', event.value);
}
})
)
.appendTo($statistics);
}
function editMetadata(key, value) { function editMetadata(key, value) {
if (value != data[key]) { if (value != data[key]) {
var edit = { var edit = {