diff --git a/src/notes_history_api.py b/src/notes_history_api.py index 8b94e5976..8b8e26a3f 100644 --- a/src/notes_history_api.py +++ b/src/notes_history_api.py @@ -19,4 +19,11 @@ notes_history_api = Blueprint('notes_history_api', __name__) def getNoteHistory(note_id): history = getResults("select * from notes_history where note_id = ? order by date_modified desc", [note_id]) - return jsonify(history) \ No newline at end of file + return jsonify(history) + +@notes_history_api.route('/recent-changes/', methods = ['GET']) +@login_required +def getRecentChanges(): + recent_changes = getResults("select * from notes_history order by date_modified desc limit 1000") + + return jsonify(recent_changes) \ No newline at end of file diff --git a/src/templates/app.html b/src/templates/app.html index 1cb2eb8cf..90e765247 100644 --- a/src/templates/app.html +++ b/src/templates/app.html @@ -184,6 +184,9 @@ +
+ @@ -244,6 +247,7 @@ + diff --git a/static/js/add_link.js b/static/js/add_link.js index 66f183a6f..c06c77797 100644 --- a/static/js/add_link.js +++ b/static/js/add_link.js @@ -72,6 +72,10 @@ $("#insertLinkForm").submit(function() { // when click on link popup, in case of internal link, just go the the referenced note instead of default behavior // of opening the link in new window/tab $(document).on('click', 'div.popover-content a', function(e) { + goToInternalNote(e); +}); + +function goToInternalNote(e, callback) { const targetUrl = $(e.target).attr("href"); const noteIdMatch = /app#([A-Za-z0-9]{22})/.exec(targetUrl); @@ -82,8 +86,12 @@ $(document).on('click', 'div.popover-content a', function(e) { getNodeByKey(noteId).setActive(); e.preventDefault(); + + if (callback) { + callback(); + } } -}); +} function getNodeIdFromLabel(label) { const noteIdMatch = / \(([A-Za-z0-9]{22})\)/.exec(label); diff --git a/static/js/init.js b/static/js/init.js index ab6f6f1e7..6056f660a 100644 --- a/static/js/init.js +++ b/static/js/init.js @@ -15,16 +15,22 @@ $(document).bind('keydown', 'alt+s', function() { $("input[name=search]").focus(); }); +function formatTime(date) { + return (date.getHours() <= 9 ? "0" : "") + date.getHours() + ":" + (date.getMinutes() <= 9 ? "0" : "") + date.getMinutes(); +} + function formatDate(date) { - const dateString = date.getDate() + ". " + (date.getMonth() + 1) + ". " + date.getFullYear() + " " + - date.getHours() + ":" + (date.getMinutes() <= 9 ? "0": "") + date.getMinutes(); - return dateString; + return date.getDate() + ". " + (date.getMonth() + 1) + ". " + date.getFullYear(); +} + +function formatDateTime(date) { + return formatDate(date) + " " + formatTime(date); } // hide (toggle) everything except for the note content for distraction free writing $(document).bind('keydown', 'alt+t', function() { const date = new Date(); - const dateString = formatDate(date); + const dateString = formatDateTime(date); $('#noteDetail').summernote('insertText', dateString); }); diff --git a/static/js/note_history.js b/static/js/note_history.js index 9e022d0ae..cf085e0b3 100644 --- a/static/js/note_history.js +++ b/static/js/note_history.js @@ -21,7 +21,7 @@ $(document).bind('keydown', 'alt+h', function() { $("#noteHistoryList").append($('