update document metadata

This commit is contained in:
j 2024-02-26 12:14:42 +00:00
commit eb0e8a4aa7
2 changed files with 211 additions and 7 deletions

View file

@ -202,6 +202,87 @@ pandora.ui.documentInfoView = function(data, isMixed) {
pandora.createLinks($info);
}
// Group & Publication description -----------------------------------------------------
if (!isMultiple) {
;['group', 'publication'].forEach(key => {
var $box = $('<div>').appendTo($data);
(data[key] ? pandora.api.findEntities : Ox.noop)({
query: {
conditions: [{
key: 'type', operator: '==', value: Ox.decodeHTMLEntities(key)
}, {
key: 'name', operator: '==', value: Ox.decodeHTMLEntities(data[key] || '')
}],
operator: '&'
},
keys: ['id', 'name', 'description']
}, function(result) {
if (data[key] && ((result && result.data.items.length == 1) || canEdit)) {
var entity = {}
if (result && result.data.items.length) {
entity = result.data.items[0]
}
$('<div>')
.html(Ox._('About {0}:', [data[key]]))
.css({
'padding-top': '4px',
'font-weight': 'bold'
})
.appendTo($box);
$('<div>')
.append(
Ox.EditableContent({
clickLink: pandora.clickLink,
editable: false,
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 {0} Description', [Ox._(Ox.toTitleCase(key))])),
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: entity.description || ''
})
.css(css)
.css({
'text-align': ''
})
.bindEvent({
doubleclick: function(event) {
if (!canEdit) {
return
}
if (entity.id) {
var set = {}
set['entitiesType'] = key
set['entitiesSelection.' + key] = [entity.id];
pandora.UI.set(set);
pandora.$ui.entitiesDialog = pandora.ui.entitiesDialog().open();
} else {
pandora.api.addEntity({
type: key,
name: data[key]
}, function(result) {
var set = {}
set['entitiesType'] = key
set['entitiesSelection.' + key] = [result.data.id];
pandora.UI.set(set);
pandora.$ui.entitiesDialog = pandora.ui.entitiesDialog().open();
})
}
}
})
).css({
margin: '12px 0',
})
.appendTo($box);
}
})
});
}
// Title -------------------------------------------------------------------
$('<div>')
@ -229,8 +310,16 @@ pandora.ui.documentInfoView = function(data, isMixed) {
// Director, Year and Country ----------------------------------------------
renderGroup(['author', 'date', 'type']);
renderGroup(['publisher', 'place', 'series', 'edition', 'language']);
renderGroup(['group', 'author']);
renderGroup(['publication']);
renderGroup(['date', 'format', 'language']);
renderGroup(['publisher', 'series', 'volume', 'issue']);
renderGroup(['source', 'links']);
renderGroup(['place', 'space']);
renderGroup(['movement', 'event']);
renderGroup(['associatedgroups', 'relatedpeople']);
renderGroup(['tags']);
// Description -------------------------------------------------------------