diff --git a/public/javascripts/note_history.js b/public/javascripts/note_history.js index 7764ce89a..a3264cce4 100644 --- a/public/javascripts/note_history.js +++ b/public/javascripts/note_history.js @@ -1,61 +1,76 @@ -glob.historyItems = null; +const noteHistory = (function() { + const dialogEl = $("#note-history-dialog"); + const listEl = $("#note-history-list"); + const contentEl = $("#note-history-content"); + const titleEl = $("#note-history-title"); -function showCurrentNoteHistory() { - showNoteHistoryDialog(glob.currentNote.detail.note_id); -} + let historyItems = []; -function showNoteHistoryDialog(noteId, noteHistoryId) { - $("#note-history-dialog").dialog({ - modal: true, - width: 800, - height: 700 - }); - - $("#note-history-list").empty(); - $("#note-history-content").empty(); - - $.ajax({ - url: baseApiUrl + 'notes-history/' + noteId, - type: 'GET', - success: result => { - glob.historyItems = result; - - for (const row of result) { - const dateModified = getDateFromTS(row.date_modified_to); - - $("#note-history-list").append($('