From 6e10bb17d2b5bc5392fd65973174595852dd9a0b Mon Sep 17 00:00:00 2001 From: j Date: Tue, 12 Nov 2019 18:18:12 +0000 Subject: [PATCH] display any additional fields specified in config on info page --- static/js/infoView.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/static/js/infoView.js b/static/js/infoView.js index a484ac276..abdc41803 100644 --- a/static/js/infoView.js +++ b/static/js/infoView.js @@ -38,6 +38,15 @@ pandora.ui.infoView = function(data, isMixed) { }) ), posterKeys = nameKeys.concat(['title', 'year']), + displayedKeys = [ // FIXME: can tis be a flag in the config? + 'title', 'notes', 'name', 'summary', 'id', + 'hue', 'saturation', 'lightness', 'cutsperminute', 'volume', + 'user', 'rightslevel', 'bitrate', 'timesaccessed', + 'numberoffiles', 'numberofannotations', 'numberofcuts', 'words', 'wordsperminute', + 'duration', 'aspectratio', 'pixels', 'size', 'resolution', + 'created', 'modified', 'accessed', + 'random' + ], statisticsWidth = 128, $bar = Ox.Bar({size: 16}) @@ -236,14 +245,18 @@ pandora.ui.infoView = function(data, isMixed) { ) .appendTo($text); - // Director, Year and Country ---------------------------------------------- + // Director, Year and Country, Language -------------------------------- - renderGroup(['director', 'year', 'country']); + renderGroup(['director', 'year', 'country', 'language']); // Featuring ---------------------------------------------- renderGroup(['featuring']); + // Render any remaing keys defined in config + + renderRemainingKeys(); + // Summary ----------------------------------------------------------------- if (canEdit || data.summary) { @@ -278,6 +291,7 @@ pandora.ui.infoView = function(data, isMixed) { .appendTo($text); } + // Duration, Aspect Ratio -------------------------------------------------- if (!isMultiple) { ['duration', 'aspectratio'].forEach(function(key) { @@ -575,6 +589,7 @@ pandora.ui.infoView = function(data, isMixed) { function renderGroup(keys) { var $element; + keys.forEach(function(key) { displayedKeys.push(key) }); if (canEdit || keys.filter(function(key) { return data[key]; }).length) { @@ -606,6 +621,17 @@ pandora.ui.infoView = function(data, isMixed) { } } + function renderRemainingKeys() { + var keys = pandora.site.itemKeys.filter(function(item) { + return item.id != '*' && item.type != 'layer' && !Ox.contains(displayedKeys, item.id); + }).map(function(item) { + return item.id; + }); + if (keys.length) { + renderGroup(keys) + } + } + function renderRightsLevel() { var $rightsLevelElement = getRightsLevelElement(data.rightslevel), $rightsLevelSelect;