From e903e115e1758a7cad212a497e210f53e4891e85 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Mon, 21 Feb 2022 12:39:32 +0100 Subject: [PATCH] Prettier category names --- capsule-prototype/js/online-script.js | 2 +- capsule-prototype/js/rekall/Sorting.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/capsule-prototype/js/online-script.js b/capsule-prototype/js/online-script.js index a22c231..dd64c9b 100644 --- a/capsule-prototype/js/online-script.js +++ b/capsule-prototype/js/online-script.js @@ -855,7 +855,7 @@ function openMosaic() { container.append(filterdiv); // TODO is there a better way to iterate over tags or documents ? for ( let [k, v] of Object.entries(rekall.sortings.colors.categories)) { - let categoryName = v.categoryRaw; + let categoryName = rekall.sortings.colors.getCategoryName(k) let category = $('<div/>').addClass('mosaic_category').css('background', getTagGradientColor(v)); let grid = $('<div/>').addClass('mosaic_category_grid'); diff --git a/capsule-prototype/js/rekall/Sorting.js b/capsule-prototype/js/rekall/Sorting.js index 720a489..6255067 100644 --- a/capsule-prototype/js/rekall/Sorting.js +++ b/capsule-prototype/js/rekall/Sorting.js @@ -335,4 +335,14 @@ Sorting.unmapPosition = function(x) { Sorting.prototype.getCategory = function(tag) { var metadata = this.parseMeta(tag.getMetadata(this.metadataKey)); return this.categories[metadata]; -} \ No newline at end of file +} + +Sorting.prototype.getCategoryName = function(metadata) { + if ('_rekall/link' === metadata) { + return 'Link'; + } + if ('_rekall/marker' === metadata) { + return 'Note'; + } + return metadata.substr(7).toUpperCase(); +} -- GitLab