From ec6d93b34ffcdaa7bf8ed065be8e558ab0a780ea Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 13 Jun 2022 00:00:15 +0200 Subject: [PATCH] converted help dialog to new pattern --- src/public/app/dialogs/help.js | 7 ------- src/public/app/layouts/desktop_layout.js | 4 +++- .../app/services/root_command_executor.js | 4 ---- .../app/widgets/dialogs/help.js} | 18 ++++++++++++++++-- src/views/desktop.ejs | 1 - 5 files changed, 19 insertions(+), 15 deletions(-) delete mode 100644 src/public/app/dialogs/help.js rename src/{views/dialogs/help.ejs => public/app/widgets/dialogs/help.js} (96%) diff --git a/src/public/app/dialogs/help.js b/src/public/app/dialogs/help.js deleted file mode 100644 index ed8d90a48..000000000 --- a/src/public/app/dialogs/help.js +++ /dev/null @@ -1,7 +0,0 @@ -import utils from "../services/utils.js"; - -const $dialog = $("#help-dialog"); - -export async function showDialog() { - utils.openDialog($dialog); -} \ No newline at end of file diff --git a/src/public/app/layouts/desktop_layout.js b/src/public/app/layouts/desktop_layout.js index d64fb02d0..bb8dcfd7d 100644 --- a/src/public/app/layouts/desktop_layout.js +++ b/src/public/app/layouts/desktop_layout.js @@ -53,6 +53,7 @@ import TocWidget from "../widgets/toc.js"; import BulkActionsDialog from "../widgets/dialogs/bulk_actions.js"; import AboutDialog from "../widgets/dialogs/about.js"; import NoteSourceDialog from "../dialogs/note_source.js"; +import HelpDialog from "../widgets/dialogs/help.js"; export default class DesktopLayout { constructor(customWidgets) { @@ -180,6 +181,7 @@ export default class DesktopLayout { ) .child(new BulkActionsDialog()) .child(new AboutDialog()) - .child(new NoteSourceDialog()); + .child(new NoteSourceDialog()) + .child(new HelpDialog()); } } diff --git a/src/public/app/services/root_command_executor.js b/src/public/app/services/root_command_executor.js index a44c0903d..d0e92e0f0 100644 --- a/src/public/app/services/root_command_executor.js +++ b/src/public/app/services/root_command_executor.js @@ -54,10 +54,6 @@ export default class RootCommandExecutor extends Component { import("../dialogs/options.js").then(d => d.showDialog(openTab)); } - showHelpCommand() { - import("../dialogs/help.js").then(d => d.showDialog()); - } - async showSQLConsoleCommand() { const sqlConsoleNote = await dateNoteService.createSqlConsole(); diff --git a/src/views/dialogs/help.ejs b/src/public/app/widgets/dialogs/help.js similarity index 96% rename from src/views/dialogs/help.ejs rename to src/public/app/widgets/dialogs/help.js index 541556ee7..d3f8ecf4f 100644 --- a/src/views/dialogs/help.ejs +++ b/src/public/app/widgets/dialogs/help.js @@ -1,4 +1,8 @@ -`; + +export default class HelpDialog extends BasicWidget { + doRender() { + this.$widget = $(TPL); + } + + showHelpEvent() { + utils.openDialog(this.$widget); + } +} diff --git a/src/views/desktop.ejs b/src/views/desktop.ejs index faa77a298..2cc03b224 100644 --- a/src/views/desktop.ejs +++ b/src/views/desktop.ejs @@ -30,7 +30,6 @@ <%- include('dialogs/info.ejs') %> <%- include('dialogs/prompt.ejs') %> <%- include('dialogs/confirm.ejs') %> -<%- include('dialogs/help.ejs') %> <%- include('dialogs/clone_to.ejs') %> <%- include('dialogs/move_to.ejs') %> <%- include('dialogs/backend_log.ejs') %>