From eb4d86f41d5edac815e4df64caff492e5d0d77c5 Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 6 Sep 2020 22:48:52 +0200 Subject: [PATCH] changed presentation of similar notes to "tag cloud" style --- .../collapsible_widgets/similar_notes.js | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/public/app/widgets/collapsible_widgets/similar_notes.js b/src/public/app/widgets/collapsible_widgets/similar_notes.js index 708c6a0ac..29561dfbb 100644 --- a/src/public/app/widgets/collapsible_widgets/similar_notes.js +++ b/src/public/app/widgets/collapsible_widgets/similar_notes.js @@ -3,9 +3,36 @@ import linkService from "../../services/link.js"; import server from "../../services/server.js"; import treeCache from "../../services/tree_cache.js"; +const TPL = ` +
+ + +
+
+`; + export default class SimilarNotesWidget extends CollapsibleWidget { get widgetTitle() { return "Similar notes"; } + async doRenderBody() { + this.$body.html(TPL); + + this.$similarNotesContent = this.$body.find(".similar-notes-content"); + } + get help() { return { title: "This list contains notes which might be similar to the current note based on textual similarity of note title." @@ -15,7 +42,7 @@ export default class SimilarNotesWidget extends CollapsibleWidget { noteSwitched() { const noteId = this.noteId; - this.$body.empty(); + this.$similarNotesContent.empty(); // avoid executing this expensive operation multiple times when just going through notes (with keyboard especially) // until the users settles on a note @@ -33,7 +60,7 @@ export default class SimilarNotesWidget extends CollapsibleWidget { const similarNotes = await server.get('similar-notes/' + this.noteId); if (similarNotes.length === 0) { - this.$body.text("No similar notes found ..."); + this.$similarNotesContent.text("No similar notes found ..."); return; } @@ -41,7 +68,7 @@ export default class SimilarNotesWidget extends CollapsibleWidget { await treeCache.getNotes(noteIds, true); // preload all at once - const $list = $('