diff --git a/config.jsonc b/config.jsonc index eb9b2e8..fa7a312 100644 --- a/config.jsonc +++ b/config.jsonc @@ -557,7 +557,26 @@ "id" and "name" keys are required. If "alternativeNames" is present, these will act as synonyms when autocompleting values entered as annotations. */ - "entities": [], + "entities": [ + { + "id": "group", + "title": "Group", + "keys": [ + {"id": "id", "title": "ID", "type": "string"}, + {"id": "name", "title": "Name", "type": "string"}, + {"id": "description", "title": "Description", "type": "text"} + ] + }, + { + "id": "publication", + "title": "Publication", + "keys": [ + {"id": "id", "title": "ID", "type": "string"}, + {"id": "name", "title": "Name", "type": "string"}, + {"id": "description", "title": "Description", "type": "text"} + ] + } + ], /* "flags", if set to true, will cause flag icons to appear in filters. */ diff --git a/static/html/entities.publication.entity.html b/static/html/entities.publication.entity.html new file mode 100644 index 0000000..33b40c1 --- /dev/null +++ b/static/html/entities.publication.entity.html @@ -0,0 +1,8 @@ +
+
+
About {name}:
+
+
{description}
+
+
+
diff --git a/static/js/documentInfoView.leftovers.js b/static/js/documentInfoView.leftovers.js index 5abc159..fc003d7 100644 --- a/static/js/documentInfoView.leftovers.js +++ b/static/js/documentInfoView.leftovers.js @@ -112,6 +112,12 @@ pandora.ui.documentInfoView = function(data, isMixed) { }); if (!isMultiple) { + var $left = Ox.Element() + .css({ + position: 'absolute' + }) + .appendTo($info); + var $icon = Ox.Element({ element: '', }) @@ -128,7 +134,7 @@ pandora.ui.documentInfoView = function(data, isMixed) { .bindEvent({ singleclick: toggleIconSize }) - .appendTo($info), + .appendTo($left), $reflection = $('
') .addClass('OxReflection') @@ -140,7 +146,7 @@ pandora.ui.documentInfoView = function(data, isMixed) { height: iconSize / 2 + 'px', overflow: 'hidden' }) - .appendTo($info), + .appendTo($left), $reflectionIcon = $('') .attr({ @@ -163,6 +169,16 @@ pandora.ui.documentInfoView = function(data, isMixed) { .appendTo($reflection); } + var $data = $('
') + .addClass('OxTextPage') + .css({ + position: 'absolute', + left: margin + 'px', + top: margin + iconHeight + margin + 'px', + width: iconSize + 'px', + }) + .appendTo($left); + var $text = Ox.Element() .addClass('OxTextPage') .css({ @@ -201,6 +217,83 @@ pandora.ui.documentInfoView = function(data, isMixed) { if (!canEdit) { pandora.createLinks($info); } + // Group & Publication description ----------------------------------------------------- + if (!isMultiple) { + ;['group', 'publication'].forEach(key => { + var $box = $('
').appendTo($data); + (data[key] ? pandora.api.findEntities : Ox.noop)({ + query: { + conditions: [{ + key: 'type', operator: '==', value: key + }, { + key: 'name', operator: '==', value: data[key] + }], + operator: '&' + }, + keys: ['id', 'name', 'description'] + }, function(result) { + if ((result && result.data.items.length == 1) || canEdit) { + var entity = {} + if (result && result.data.items.length) { + entity = result.data.items[0] + } + $('
') + .html(Ox._('About {0}:', [data[key]])) + .css({ + 'padding-top': '4px', + 'font-weight': 'bold' + }) + .appendTo($box); + $('
') + .append( + Ox.EditableContent({ + clickLink: pandora.clickLink, + editable: false, + format: function(value) { + return value.replace( + /') + .html('Description:') + .css({ + 'padding-top': '4px', + 'font-weight': 'bold' + }) + .appendTo($text); $('
') .append( Ox.EditableContent({ @@ -276,6 +375,13 @@ pandora.ui.documentInfoView = function(data, isMixed) { } if (canEdit || data.content) { + $('
') + .html('Content:') + .css({ + 'padding-top': '4px', + 'font-weight': 'bold' + }) + .appendTo($text); $('
') .append( Ox.EditableContent({