added event log dialog

This commit is contained in:
azivner
2017-11-03 23:00:35 -04:00
parent e35c2dd4ad
commit 3892666961
8 changed files with 121 additions and 47 deletions

View File

@@ -62,13 +62,8 @@ $("#insert-link-form").submit(() => {
// 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, div.ui-tooltip-content', e => {
goToInternalNote(e);
});
$(document).on('dblclick', '.note-editable a, div.ui-tooltip-content', e => {
goToInternalNote(e);
});
$(document).on('click', 'div.popover-content a, div.ui-tooltip-content', goToInternalNote);
$(document).on('dblclick', '.note-editable a, div.ui-tooltip-content', goToInternalNote);
function goToInternalNote(e, callback) {
const targetUrl = $(e.target).attr("href");

View File

@@ -0,0 +1,42 @@
async function showEventLog() {
$("#event-log-dialog").dialog({
modal: true,
width: 800,
height: 700
});
const result = await $.ajax({
url: baseApiUrl + 'event-log',
type: 'GET',
error: () => error("Error getting event log.")
});
const eventLogList = $("#event-log-list");
eventLogList.html('');
for (const event of result) {
const dateTime = formatDateTime(getDateFromTS(event.date_added));
if (event.note_id) {
const noteLink = $("<a>", {
href: 'app#' + event.note_id,
text: event.note_title
}).prop('outerHTML');
console.log(noteLink);
event.comment = event.comment.replace('<note>', noteLink);
}
const eventEl = $('<li>').html(dateTime + " - " + event.comment);
eventLogList.append(eventEl);
}
}
$(document).on('click', '#event-log-dialog a', e => {
goToInternalNote(e, () => {
$("#event-log-dialog").dialog('close');
});
});

View File

@@ -21,7 +21,7 @@ function showRecentChanges() {
}
let dateDay = getDateFromTS(row.date_modified);
let dateDay = getDateFromTS(row.date_modified_to);
dateDay.setHours(0);
dateDay.setMinutes(0);
dateDay.setSeconds(0);
@@ -49,7 +49,7 @@ function showRecentChanges() {
const dayEl = $('<div>').append($('<b>').html(formatDate(dateDay))).append(changesListEl);
for (const change of dayChanges) {
const formattedTime = formatTime(getDateFromTS(change.date_modified));
const formattedTime = formatTime(getDateFromTS(change.date_modified_to));
const noteLink = $("<a>", {
href: 'app#' + change.note_id,
@@ -57,7 +57,7 @@ function showRecentChanges() {
});
const revLink = $("<a>", {
href: "javascript: showNoteHistoryDialog('" + change.note_id + "', " + change.id + ");",
href: "javascript: showNoteHistoryDialog('" + change.note_id + "', '" + change.note_history_id + "');",
text: 'rev'
});