more generic handling of links to note

This commit is contained in:
azivner
2017-11-04 17:03:15 -04:00
parent c723bfc3ac
commit 819ae7c4c0
8 changed files with 118 additions and 103 deletions

View File

@@ -10,12 +10,9 @@ const noteHistory = (function() {
await showNoteHistoryDialog(glob.currentNote.detail.note_id);
}
// weird hack because browser doesn't like we're returning promise and displays promise page
function showNoteHistoryDialogNotAsync(noteId, noteHistoryId) {
showNoteHistoryDialog(noteId, noteHistoryId);
}
async function showNoteHistoryDialog(noteId, noteHistoryId) {
glob.activeDialog = dialogEl;
dialogEl.dialog({
modal: true,
width: 800,
@@ -68,9 +65,17 @@ const noteHistory = (function() {
contentEl.html(noteText);
});
$(document).on('click', "a[action='note-history']", event => {
const linkEl = $(event.target);
const noteId = linkEl.attr('note-id');
const noteHistoryId = linkEl.attr('note-history-id');
showNoteHistoryDialog(noteId, noteHistoryId);
return false;
});
return {
showCurrentNoteHistory,
showNoteHistoryDialog,
showNoteHistoryDialogNotAsync
showCurrentNoteHistory
};
})();