From a6b5d8d40e09bffda50759602666599429596751 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 2 Jun 2024 11:22:15 +0100 Subject: [PATCH] add poster script --- .gitignore | 1 + static/js/infoView.firefly.js | 103 +++++++++++++++++++++++++++++++--- 2 files changed, 96 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 0d20b64..c9b568f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.pyc +*.swp diff --git a/static/js/infoView.firefly.js b/static/js/infoView.firefly.js index fd18345..010ce6f 100644 --- a/static/js/infoView.firefly.js +++ b/static/js/infoView.firefly.js @@ -122,6 +122,12 @@ pandora.ui.infoView = function(data, isMixed) { orientation: 'vertical' }); + var $left = Ox.Element() + .css({ + position: 'absolute' + }) + .appendTo($info); + if (!isMultiple) { var $icon = Ox.Element({ element: '', @@ -143,7 +149,7 @@ pandora.ui.infoView = function(data, isMixed) { .bindEvent({ singleclick: toggleIconSize }) - .appendTo($info), + .appendTo($left), $reflection = $('
') .addClass('OxReflection') @@ -155,7 +161,7 @@ pandora.ui.infoView = function(data, isMixed) { height: iconSize / 2 + 'px', overflow: 'hidden' }) - .appendTo($info), + .appendTo($left), $reflectionIcon = $('') .attr({ @@ -181,6 +187,16 @@ pandora.ui.infoView = 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({ @@ -218,6 +234,82 @@ pandora.ui.infoView = function(data, isMixed) { pandora.createLinks($info); } + // Show description ----------------------------------------------------- + if (!isMultiple) { + ;['show'].forEach(key => { + var $box = $('
').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][0] || '') + }], + operator: '&' + }, + keys: ['id', 'name', 'description', 'image'] + }, 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] + } + $('
') + .html(Ox._('About {0}:', [data[key]])) + .css({ + 'padding-top': '4px', + 'font-weight': 'bold' + }) + .appendTo($box); + $('
') + .addClass("InlineImages") + .append( + Ox.EditableContent({ + clickLink: pandora.clickLink, + editable: false, + 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 ------------------------------------------------------------------- $('
') @@ -260,16 +352,11 @@ pandora.ui.infoView = function(data, isMixed) { if (canEdit || data.summary) { $('
') + .addClass("InlineImages") .append( Ox.EditableContent({ clickLink: pandora.clickLink, editable: canEdit, - format: function(value) { - return value.replace( - /