From 2a2319d4349f128976445421f55bf325acc0cfa9 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 14 Feb 2019 20:56:33 +0100 Subject: [PATCH] created note info dialog, closes #408 --- src/public/javascripts/dialogs/note_info.js | 29 ++++++++++++++ src/public/javascripts/entities/note_full.js | 12 +++--- .../javascripts/services/entrypoints.js | 3 ++ src/public/stylesheets/desktop.css | 4 ++ src/views/desktop.ejs | 2 + src/views/dialogs/note_info.ejs | 39 +++++++++++++++++++ 6 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 src/public/javascripts/dialogs/note_info.js create mode 100644 src/views/dialogs/note_info.ejs diff --git a/src/public/javascripts/dialogs/note_info.js b/src/public/javascripts/dialogs/note_info.js new file mode 100644 index 000000000..26d610a46 --- /dev/null +++ b/src/public/javascripts/dialogs/note_info.js @@ -0,0 +1,29 @@ +import noteDetailService from '../services/note_detail.js'; + +const $dialog = $("#note-info-dialog"); +const $noteId = $("#note-info-note-id"); +const $dateCreated = $("#note-info-date-created"); +const $dateModified = $("#note-info-date-modified"); +const $type = $("#note-info-type"); +const $mime = $("#note-info-mime"); +const $okButton = $("#note-info-ok-button"); + +function showDialog() { + glob.activeDialog = $dialog; + + $dialog.modal(); + + const currentNote = noteDetailService.getCurrentNote(); + + $noteId.text(currentNote.noteId); + $dateCreated.text(currentNote.dateCreated); + $dateModified.text(currentNote.dateModified); + $type.text(currentNote.type); + $mime.text(currentNote.mime); +} + +$okButton.click(() => $dialog.modal('hide')); + +export default { + showDialog +}; \ No newline at end of file diff --git a/src/public/javascripts/entities/note_full.js b/src/public/javascripts/entities/note_full.js index 3fd6cc530..44964669c 100644 --- a/src/public/javascripts/entities/note_full.js +++ b/src/public/javascripts/entities/note_full.js @@ -10,13 +10,11 @@ class NoteFull extends NoteShort { /** @param {string} */ this.noteContent = row.noteContent; - // if (this.content !== "" && this.isJson()) { - // try { - // /** @param {object} */ - // this.jsonContent = JSON.parse(this.content); - // } - // catch(e) {} - // } + /** @param {string} */ + this.dateCreated = row.dateCreated; + + /** @param {string} */ + this.dateModified = row.dateModified; } } diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js index 884f8a8b0..65ba115b0 100644 --- a/src/public/javascripts/services/entrypoints.js +++ b/src/public/javascripts/services/entrypoints.js @@ -13,6 +13,7 @@ import sqlConsoleDialog from "../dialogs/sql_console.js"; import searchNotesService from "./search_notes.js"; import attributesDialog from "../dialogs/attributes.js"; import helpDialog from "../dialogs/help.js"; +import noteInfoDialog from "../dialogs/note_info.js"; import protectedSessionService from "./protected_session.js"; function registerEntrypoints() { @@ -61,6 +62,8 @@ function registerEntrypoints() { $("#open-sql-console-button").click(sqlConsoleDialog.showDialog); utils.bindShortcut('alt+o', sqlConsoleDialog.showDialog); + $("#show-note-info-button").click(noteInfoDialog.showDialog); + if (utils.isElectron()) { $("#history-navigation").show(); $("#history-back-button").click(window.history.back); diff --git a/src/public/stylesheets/desktop.css b/src/public/stylesheets/desktop.css index b3062f51c..c51341606 100644 --- a/src/public/stylesheets/desktop.css +++ b/src/public/stylesheets/desktop.css @@ -104,4 +104,8 @@ body { ::-webkit-scrollbar-thumb { border-radius: 3px; border: 1px solid var(--main-border-color); +} + +#note-info-table td, #note-info-table th { + padding: 15px; } \ No newline at end of file diff --git a/src/views/desktop.ejs b/src/views/desktop.ejs index 55bf0e3e2..95cc87da6 100644 --- a/src/views/desktop.ejs +++ b/src/views/desktop.ejs @@ -199,6 +199,7 @@ Note source Upload file Export note + Note info @@ -226,6 +227,7 @@ <% include dialogs/prompt.ejs %> <% include dialogs/confirm.ejs %> <% include dialogs/help.ejs %> + <% include dialogs/note_info.ejs %> diff --git a/src/views/dialogs/note_info.ejs b/src/views/dialogs/note_info.ejs new file mode 100644 index 000000000..df24338b9 --- /dev/null +++ b/src/views/dialogs/note_info.ejs @@ -0,0 +1,39 @@ +