renaming note_tree to branch

This commit is contained in:
azivner
2018-03-24 21:39:15 -04:00
parent 511fb89af0
commit 4c472ce78b
45 changed files with 540 additions and 508 deletions

View File

@@ -43,13 +43,13 @@ const addLink = (function() {
$linkTitle.val('');
function setDefaultLinkTitle(noteId) {
const noteTitle = noteTree.getNoteTitle(noteId);
const noteTitle = treeService.getNoteTitle(noteId);
$linkTitle.val(noteTitle);
}
$autoComplete.autocomplete({
source: noteTree.getAutocompleteItems(),
source: treeService.getAutocompleteItems(),
minLength: 0,
change: () => {
const val = $autoComplete.val();

View File

@@ -6,7 +6,7 @@ const editTreePrefix = (function() {
const $treePrefixInput = $("#tree-prefix-input");
const $noteTitle = $('#tree-prefix-note-title');
let noteTreeId;
let branchId;
async function showDialog() {
glob.activeDialog = $dialog;
@@ -16,14 +16,14 @@ const editTreePrefix = (function() {
width: 500
});
const currentNode = noteTree.getCurrentNode();
const currentNode = treeService.getCurrentNode();
noteTreeId = currentNode.data.noteTreeId;
const nt = noteTree.getNoteTree(noteTreeId);
branchId = currentNode.data.branchId;
const nt = treeService.getBranch(branchId);
$treePrefixInput.val(nt.prefix).focus();
const noteTitle = noteTree.getNoteTitle(currentNode.data.noteId);
const noteTitle = treeService.getNoteTitle(currentNode.data.noteId);
$noteTitle.html(noteTitle);
}
@@ -31,9 +31,9 @@ const editTreePrefix = (function() {
$form.submit(() => {
const prefix = $treePrefixInput.val();
server.put('tree/' + noteTreeId + '/set-prefix', {
server.put('tree/' + branchId + '/set-prefix', {
prefix: prefix
}).then(() => noteTree.setPrefix(noteTreeId, prefix));
}).then(() => treeService.setPrefix(branchId, prefix));
$dialog.dialog("close");

View File

@@ -17,7 +17,7 @@ const jumpToNote = (function() {
});
await $autoComplete.autocomplete({
source: await stopWatch("building autocomplete", noteTree.getAutocompleteItems),
source: await stopWatch("building autocomplete", treeService.getAutocompleteItems),
minLength: 0
});
}
@@ -31,7 +31,7 @@ const jumpToNote = (function() {
const notePath = getSelectedNotePath();
if (notePath) {
noteTree.activateNode(notePath);
treeService.activateNode(notePath);
$dialog.dialog('close');
}

View File

@@ -14,11 +14,11 @@ const recentNotes = (function() {
list = result.map(r => r.notePath);
}
function addRecentNote(noteTreeId, notePath) {
function addRecentNote(branchId, notePath) {
setTimeout(async () => {
// we include the note into recent list only if the user stayed on the note at least 5 seconds
if (notePath && notePath === noteTree.getCurrentNotePath()) {
const result = await server.put('recent-notes/' + noteTreeId + '/' + encodeURIComponent(notePath));
if (notePath && notePath === treeService.getCurrentNotePath()) {
const result = await server.put('recent-notes/' + branchId + '/' + encodeURIComponent(notePath));
list = result.map(r => r.notePath);
}
@@ -38,14 +38,14 @@ const recentNotes = (function() {
$searchInput.val('');
// remove the current note
const recNotes = list.filter(note => note !== noteTree.getCurrentNotePath());
const recNotes = list.filter(note => note !== treeService.getCurrentNotePath());
$searchInput.autocomplete({
source: recNotes.map(notePath => {
let noteTitle;
try {
noteTitle = noteTree.getNotePathTitle(notePath);
noteTitle = treeService.getNotePathTitle(notePath);
}
catch (e) {
noteTitle = "[error - can't find note title]";
@@ -61,7 +61,7 @@ const recentNotes = (function() {
minLength: 0,
autoFocus: true,
select: function (event, ui) {
noteTree.activateNode(ui.item.value);
treeService.activateNode(ui.item.value);
$searchInput.autocomplete('destroy');
$dialog.dialog('close');