more metadata on default info page

This commit is contained in:
j 2023-11-18 21:04:31 +01:00
parent a890b11790
commit a32ede6b2f

View file

@ -347,6 +347,77 @@ pandora.ui.infoView = function(data, isMixed) {
.appendTo($statistics); .appendTo($statistics);
pandora.renderRightsLevel(that, $rightsLevel, data, isMixed, isMultiple, canEdit); pandora.renderRightsLevel(that, $rightsLevel, data, isMixed, isMultiple, canEdit);
// User and Groups ---------------------------------------------------------
if (!isMultiple || pandora.hasCapability('canEditUsers')) {
['user', 'groups'].forEach(function(key) {
if (key == 'groups' && isMultiple) {
return
};
var $input;
(canEdit || data[key] && data[key].length) && $('<div>')
.css({marginBottom: '4px'})
.append(formatKey(key, 'statistics'))
.append(
$('<div>')
.css({margin: '2px 0 0 -1px'}) // fixme: weird
.append(
$input = Ox.Editable({
placeholder: key == 'groups'
? formatLight(Ox._(isMixed[key] ? 'Mixed Groups' : 'No Groups'))
: isMixed[key] ? formatLight(Ox._('Mixed Users')) : '',
editable: key == 'user' && canEdit,
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: isMixed[key]
? ''
: key == 'user' ? data[key] : data[key].join(', ')
})
.bindEvent(Ox.extend({
submit: function(event) {
editMetadata(key, event.value);
}
}, key == 'groups' ? {
doubleclick: canEdit ? function() {
setTimeout(function() {
if (window.getSelection) {
window.getSelection().removeAllRanges();
} else if (document.selection) {
document.selection.empty();
}
});
pandora.$ui.groupsDialog = pandora.ui.groupsDialog({
id: data.id,
name: data.title,
type: 'item'
})
.bindEvent({
groups: function(data) {
$input.options({
value: data.groups.join(', ')
});
}
})
.open();
} : function() {}
} : {}))
)
)
.appendTo($statistics);
});
// Created and Modified ----------------------------------------------------
if (!isMultiple && canEdit) {
['created', 'modified'].forEach(function(key) {
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey(key, 'statistics'))
.append(
$('<div>').html(Ox.formatDate(data[key], '%B %e, %Y'))
)
.appendTo($statistics);
});
// Notes -------------------------------------------------------------------- // Notes --------------------------------------------------------------------
if (canEdit) { if (canEdit) {