Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
sort child notes by ... WIP
zadam1c59bc4d3c08
diff --git a/src/public/app/dialogs/sort_child_notes.js b/src/public/app/dialogs/sort_child_notes.jsnew file mode 100644index 0000000000..0357dcd2bf--- /dev/null+++ b/src/public/app/dialogs/sort_child_notes.js@@ -0,0 +1,8 @@+import server from "../services/server.js";+import utils from "../services/utils.js";++const $dialog = $("#sort-child-notes-dialog");++export async function showDialog() {+ utils.openDialog($dialog);+}diff --git a/src/public/app/services/tree_context_menu.js b/src/public/app/services/tree_context_menu.jsindex d8ceb50288..8d39e9c5bd 100644--- a/src/public/app/services/tree_context_menu.js+++ b/src/public/app/services/tree_context_menu.js@@ -75,7 +75,7 @@ class TreeContextMenu {{ title: 'Expand subtree <kbd data-command="expandSubtree"></kbd>', command: "expandSubtree", uiIcon: "expand", enabled: noSelectedNotes },{ title: 'Collapse subtree <kbd data-command="collapseSubtree"></kbd>', command: "collapseSubtree", uiIcon: "collapse", enabled: noSelectedNotes },{ title: "Force note sync", command: "forceNoteSync", uiIcon: "refresh", enabled: noSelectedNotes },- { title: 'Sort alphabetically <kbd data-command="sortChildNotes"></kbd>', command: "sortChildNotes", uiIcon: "empty", enabled: noSelectedNotes && notSearch },+ { title: 'Sort by ... <kbd data-command="sortChildNotes"></kbd>', command: "sortChildNotes", uiIcon: "empty", enabled: noSelectedNotes && notSearch },{ title: 'Recent changes in subtree', command: "recentChangesInSubtree", uiIcon: "history", enabled: noSelectedNotes }] },{ title: "----" },diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.jsindex 75e34d9048..cd04c03012 100644--- a/src/public/app/widgets/note_tree.js+++ b/src/public/app/widgets/note_tree.js@@ -1370,7 +1370,7 @@ export default class NoteTreeWidget extends TabAwareWidget {}sortChildNotesCommand({node}) {- treeService.sortAlphabetically(node.data.noteId);+ import("../dialogs/sort_child_notes.js").then(d => d.showDialog(node));}async recentChangesInSubtreeCommand({node}) {diff --git a/src/views/desktop.ejs b/src/views/desktop.ejsindex 4823a894a9..3b87be91aa 100644--- a/src/views/desktop.ejs+++ b/src/views/desktop.ejs@@ -39,6 +39,7 @@<%- include('dialogs/move_to.ejs') %><%- include('dialogs/backend_log.ejs') %><%- include('dialogs/include_note.ejs') %>+<%- include('dialogs/sort_child_notes.ejs') %><script type="text/javascript">window.baseApiUrl = 'api/';diff --git a/src/views/dialogs/sort_child_notes.ejs b/src/views/dialogs/sort_child_notes.ejsnew file mode 100644index 0000000000..4b37941d82--- /dev/null+++ b/src/views/dialogs/sort_child_notes.ejs@@ -0,0 +1,74 @@+<div id="sort-child-notes-dialog" class="modal mx-auto" tabindex="-1" role="dialog">+ <div class="modal-dialog modal-lg" style="max-width: 500px" role="document">+ <div class="modal-content">+ <div class="modal-header">+ <h5 class="modal-title mr-auto">Sort children by ...</h5>++ <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">+ <span aria-hidden="true">×</span>+ </button>+ </div>+ <form id="move-to-form">+ <div class="modal-body">+ <h5>Sorting criteria</h5>++ <div class="form-check">+ <input class="form-check-input" type="checkbox" value="" id="defaultCheck2">+ <label class="form-check-label" for="defaultCheck2">+ title+ </label>+ </div>++ <div class="form-check">+ <input class="form-check-input" type="checkbox" value="" id="defaultCheck2">+ <label class="form-check-label" for="defaultCheck2">+ date created+ </label>+ </div>++ <div class="form-check">+ <input class="form-check-input" type="checkbox" value="" id="defaultCheck2">+ <label class="form-check-label" for="defaultCheck2">+ date modified+ </label>+ </div>++ <div class="form-check">+ <input class="form-check-input" type="checkbox" value="" id="defaultCheck2">+ <label class="form-check-label" for="defaultCheck2">+ note content size+ </label>+ </div>++ <div class="form-check">+ <input class="form-check-input" type="checkbox" value="" id="defaultCheck2">+ <label class="form-check-label" for="defaultCheck2">+ note content size including revisions+ </label>+ </div>++ <br/>++ <h5>Sorting direction</h5>++ <div class="form-check">+ <input class="form-check-input" type="checkbox" value="" id="defaultCheck2">+ <label class="form-check-label" for="defaultCheck2">+ ascending+ </label>+ </div>++ <div class="form-check">+ <input class="form-check-input" type="checkbox" value="" id="defaultCheck2">+ <label class="form-check-label" for="defaultCheck2">+ descending+ </label>+ </div>+ </div>+ <div class="modal-footer">+ <button type="submit" class="btn btn-primary">Sort <kbd>enter</kbd></button>+ </div>+ </form>+ </div>+ </div>+</div>