Skip to content

Build your personal knowledge base with Trilium Notes

feat(client): name a workspace template as such on its badge

Elian Doran5f68640a80d5
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 5421376222..c58d6ecb17 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -3959,7 +3959,8 @@
"template_description": "This note is a template. Notes created from it inherit its attributes, so changing them here changes every one of those notes.",
"template_scope_global": "Available everywhere",
"template_scope_workspace": "Only inside its workspace",
- "template_scope_workspace_unavailable": "The template is not inside a workspace."
+ "template_scope_workspace_unavailable": "The template is not inside a workspace.",
+ "workspace_template": "Workspace template"
},
"status_bar": {
"language_title": "Change content language",
diff --git a/apps/client/src/widgets/layout/NoteBadges.spec.tsx b/apps/client/src/widgets/layout/NoteBadges.spec.tsx
index 06a2405d96..19ab6c96a6 100644
--- a/apps/client/src/widgets/layout/NoteBadges.spec.tsx
+++ b/apps/client/src/widgets/layout/NoteBadges.spec.tsx
@@ -88,9 +88,12 @@ describe("ExecuteBadge", () => {
describe("TemplateBadge", () => {
it("marks a template or a workspace template, and no other note", () => {
- for (const label of [ "#template", "#workspaceTemplate" ] as const) {
+ for (const [ label, text ] of [
+ [ "#template", "breadcrumb_badges.template" ],
+ [ "#workspaceTemplate", "breadcrumb_badges.workspace_template" ]
+ ] as const) {
const badge = renderBadge({ [label]: "" });
- expect(badge?.textContent).toBe("breadcrumb_badges.template");
+ expect(badge?.textContent).toBe(text);
expect(badge?.querySelector(".bx-copy-alt")).not.toBeNull();
}
diff --git a/apps/client/src/widgets/layout/NoteBadges.tsx b/apps/client/src/widgets/layout/NoteBadges.tsx
index 7abf8c1d5f..f057c48c7b 100644
--- a/apps/client/src/widgets/layout/NoteBadges.tsx
+++ b/apps/client/src/widgets/layout/NoteBadges.tsx
@@ -267,7 +267,7 @@ export function TemplateBadge() {
<BadgeWithDropdown
className="template-badge"
icon="bx bx-copy-alt"
- text={t("breadcrumb_badges.template")}
+ text={isTemplate ? t("breadcrumb_badges.template") : t("breadcrumb_badges.workspace_template")}
tooltip={t("breadcrumb_badges.template_description")}
dropdownProps={{ mobileBottomSheet: true }}
>
diff --git a/apps/server/src/assets/help/help_content.json b/apps/server/src/assets/help/help_content.json
index 9123c84328..22b1845ac0 100644
--- a/apps/server/src/assets/help/help_content.json
+++ b/apps/server/src/assets/help/help_content.json
@@ -77,7 +77,7 @@
"_help_S0Fos78ZfcY7": "<p>The inbox is the default destination for quickly captured notes. When a note is created without picking a location first, it lands in the inbox. This makes it easy to quickly capture notes and sort them later.</p><h2>Where the inbox is used</h2><ul><li>The <em>New note</em> button in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>.</li><li>The global <em>Create note into inbox</em> shortcut (default <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd>).</li><li>The <em>New note</em> action in the <a href=\"#root/_help_7iwde4lsKc6O\">tray icon menu</a>.</li><li>The&nbsp;<a class=\"reference-link\" href=\"#root/_help_MtPxeAWVAzMg\">Web Clipper</a>&nbsp;extension.</li><li>The <em>Create note</em> option offered when a search finds no match, in&nbsp;<a class=\"reference-link\" href=\"#root/_help_F1r9QtzQLZqm\">Jump to &amp; command palette</a>, in an empty tab and in the <code>@</code> completion of a text note.</li></ul><h2>Setting a note inbox</h2><p>To create a note inbox, apply the <code>#inbox</code> <a href=\"#root/_help_HI6GBBIduIgv\">label</a> to it.</p><p>Only one note should carry this label. If there are multiple notes, only one will be used by the application.</p><aside class=\"admonition note\"><p>If there is no inbox note, Trilium will fall back to today's <a href=\"#root/_help_l0tKav7yLHGF\">day note</a>, creating it and its calendar ancestors as needed. If the journal has been removed altogether, the note is created at the top level instead of a new journal being built for it.</p></aside><h2>Workspace inboxes</h2><p>Each <a href=\"#root/_help_9sRHySam5fXb\">workspace</a> can have its own inbox, set via the <code>#workspaceInbox</code> label.</p><p>When a new note is created while hoisted in a workspace, the location is determined in the following order:</p><ul><li>A note carrying the <code>#workspaceInbox</code> label in that workspace.</li><li>A note carrying the <code>#inbox</code> within that workspace.</li><li>Today's <a href=\"#root/_help_l0tKav7yLHGF\">day note</a>, if the workspace has a <code>#workspaceCalendarRoot</code>.</li><li>The workspace root note itself.</li></ul>",
"_help_5Ct4MAJTS4tQ": "<p>Deleted notes are listed in the <em>Deleted Notes</em> dialog (<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a> → <em>Show Deleted Notes</em>) and can be restored by pressing the <em>undelete</em> link.</p><p>If a note has child notes, they will be restored along with it. Should the original location no longer exist (e.g. the parent has been deleted), the note will be restored into the default location for new notes (<a class=\"reference-link\" href=\"#root/_help_S0Fos78ZfcY7\">Note Inbox</a>).</p><aside class=\"admonition note\"><p>When a note is hoisted in the tree, the dialog will only display notes deleted from the subtree of that hoisted note.</p></aside><p>To permanently erase deleted notes and clear the list, press the three-dots menu and select <em>Erase deleted notes now</em>.</p><p>Deleted notes are permanently erased after a certain amount of time (7 days by default). To change this interval, press the three-dots menu and select <em>Deleted Notes Settings</em>.</p>",
"_help_m3VlURMSeOrd": "<p>When an empty&nbsp;<a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a>&nbsp;note is created, a note type switcher will appear below the&nbsp;inline&nbsp;<a class=\"reference-link\" href=\"#root/_help_l7pigIGu01K2\">Title</a>. Apart from changing the note type, it's also possible to apply a <a href=\"#root/_help_KC1HB96bqqHX\">template</a>:</p><ul><li><span class=\"tn-icon bx bxl-markdown\"></span>&nbsp;<em>Markdown</em> and&nbsp;<span class=\"tn-icon bx bx-pen\"></span> <em>Canvas</em> switch the note to that type in one click.</li><li><span class=\"tn-icon bx bx-code\"></span>&nbsp;<em>Code</em> lists the scripting notes (<em>Custom CSS</em>, <em>Widget</em> and <em>Backend script</em>), then the enabled code languages.</li><li><span class=\"tn-icon bx bx-book\"></span>&nbsp;<em>Collection</em> and <span class=\"tn-icon bx bx-copy-alt\"></span><em>Template</em> list the collections and the templates.</li><li><span class=\"tn-icon bx bx-dots-vertical-rounded\"></span>&nbsp;<em>All types</em> displays the same menu as <em>Insert note after</em> in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_YtSN43OrfzaA\">Note tree contextual menu</a>, with every note type and template.</li></ul><p>Typing while the&nbsp;<span class=\"tn-icon bx bx-code\"></span> <em>Code</em>,&nbsp;<span class=\"tn-icon bx bx-copy-alt\"></span> <em>Template</em> or&nbsp;<span class=\"tn-icon bx bx-dots-vertical-rounded\"></span> <em>All types</em> menu is open narrows it down to the matching entries.</p><p>The switcher will disappear as soon as a text is entered.</p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/New%20note%20type%20switcher_image.png\" width=\"735\" height=\"143\">",
- "_help_B5dihXRDksTk": "<p>Note badges appear near the fixed note title and indicate important information about the note such as whether it is read-only. Some of the badges are also interactive.</p><figure class=\"image\"><img style=\"aspect-ratio:910/49;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Note%20badges_image.png\" width=\"910\" height=\"49\"></figure><p>The following badges are available:</p><ul><li><span class=\"tn-icon bx bx-lock-alt\"></span>&nbsp;<strong>Read-only badge</strong>, which will be shown if the note is not editable due to either automatic read-only or manual read-only. Clicking on the badge will temporarily edit the note. On the pages of the built-in user guide, which cannot be edited, the badge does nothing when clicked.</li><li><span class=\"tn-icon bx bx-share-alt\"></span>&nbsp;<strong>Share badge</strong>, which will indicate that the current note is shared. The badge will also indicate if the share is on the local network (for the desktop application without&nbsp;<a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a>&nbsp;set up) or publicly accessible (for the server).</li><li><span class=\"tn-icon bx bx-globe\"></span>&nbsp;<strong>Web clip badge</strong>, which will indicate if the note was clipped using the&nbsp;<a class=\"reference-link\" href=\"#root/_help_MtPxeAWVAzMg\">Web Clipper</a>. The badge acts as a link, so it can be clicked on to navigate to the page or right clicked for more options. When the clipper also saved the page's description, its author, or the dates it was published and last updated, clicking the badge shows these details instead, with a link to the page at the top.</li><li><span class=\"tn-icon bx bx-play\"></span>&nbsp;<strong>Execute badge</strong>, for <a href=\"#root/_help_CdNpE2pqjmI6\">scripts</a> or <a href=\"#root/_help_YKWqdJhzi2VY\">saved SQL queries</a> which have an execute button or a description.</li><li><span class=\"tn-icon bx bx-copy-alt\"></span> <strong>Template badge</strong>, for&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a> (including workspace templates). Notes created from a template inherit its attributes, so the badge is a reminder that changing them affects every such note. Clicking the badge switches the template between being offered everywhere and only while hoisted into its workspace, the latter being available only for a template inside a workspace (see&nbsp;<a class=\"reference-link\" href=\"#root/_help_9sRHySam5fXb\">Workspaces</a>).</li><li>For&nbsp;<a class=\"reference-link\" href=\"#root/_help_YzMcWlCVeW09\">Active content</a>&nbsp;(e.g. scripts, styles), a dedicated badge will be shown indicating the type of note and with an option to easily enable or disable it.</li></ul>",
+ "_help_B5dihXRDksTk": "<p>Note badges appear near the fixed note title and indicate important information about the note such as whether it is read-only. Some of the badges are also interactive.</p><figure class=\"image\"><img style=\"aspect-ratio:910/49;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Note%20badges_image.png\" width=\"910\" height=\"49\"></figure><p>The following badges are available:</p><ul><li><span class=\"tn-icon bx bx-lock-alt\"></span>&nbsp;<strong>Read-only badge</strong>, which will be shown if the note is not editable due to either automatic read-only or manual read-only. Clicking on the badge will temporarily edit the note. On the pages of the built-in user guide, which cannot be edited, the badge does nothing when clicked.</li><li><span class=\"tn-icon bx bx-share-alt\"></span>&nbsp;<strong>Share badge</strong>, which will indicate that the current note is shared. The badge will also indicate if the share is on the local network (for the desktop application without&nbsp;<a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a>&nbsp;set up) or publicly accessible (for the server).</li><li><span class=\"tn-icon bx bx-globe\"></span>&nbsp;<strong>Web clip badge</strong>, which will indicate if the note was clipped using the&nbsp;<a class=\"reference-link\" href=\"#root/_help_MtPxeAWVAzMg\">Web Clipper</a>. The badge acts as a link, so it can be clicked on to navigate to the page or right clicked for more options. When the clipper also saved the page's description, its author, or the dates it was published and last updated, clicking the badge shows these details instead, with a link to the page at the top.</li><li><span class=\"tn-icon bx bx-play\"></span>&nbsp;<strong>Execute badge</strong>, for <a href=\"#root/_help_CdNpE2pqjmI6\">scripts</a> or <a href=\"#root/_help_YKWqdJhzi2VY\">saved SQL queries</a> which have an execute button or a description.</li><li><span class=\"tn-icon bx bx-copy-alt\"></span> <strong>Template badge</strong>, for&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a> (including workspace templates, for which the badge reads <em>Workspace template</em>). Notes created from a template inherit its attributes, so the badge is a reminder that changing them affects every such note. Clicking the badge switches the template between being offered everywhere and only while hoisted into its workspace, the latter being available only for a template inside a workspace (see&nbsp;<a class=\"reference-link\" href=\"#root/_help_9sRHySam5fXb\">Workspaces</a>).</li><li>For&nbsp;<a class=\"reference-link\" href=\"#root/_help_YzMcWlCVeW09\">Active content</a>&nbsp;(e.g. scripts, styles), a dedicated badge will be shown indicating the type of note and with an option to easily enable or disable it.</li></ul>",
"_help_Bsm4fyzPJkSc": "<p><img class=\"image-style-align-right\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Save%20status%20indicator_image.png\" width=\"168\" height=\"47\">To the right of the note title, a temporary indicator appears after making a change to the document which shows whether the document has been saved.</p><p>It indicates the following states:</p><ul><li><span class=\"tn-icon bx bx-pencil\"></span>&nbsp;<em>Unsaved</em>, if the changes will be saved soon.</li><li><span class=\"tn-icon bx bx-loader\"></span>&nbsp;<em>Saving</em>, if the changes are being saved.</li><li><span class=\"tn-icon bx bx-check\"></span>&nbsp;<em>Saved</em>, if all the changes were successfully saved to the server.</li><li><span class=\"tn-icon bx bx-error\"></span>&nbsp;<em>Error</em>, if the changes could not be saved, for example due to a communication server with the server.</li></ul><p>After all changes have been saved, the indicator will hide automatically after a few seconds.</p>",
"_help_kBrnXNG3Hplm": "<p>This page explains the basic concepts related to the tree structure of notes in TriliumNext.</p><h2>Note</h2><p>A note is the central entity in TriliumNext. For more details, see&nbsp;<a class=\"reference-link\" href=\"#root/_help_BFs8mudNFgCS\">Notes</a>.</p><h2>Branch</h2><p>A branch describes the placement of a note within the note tree. Essentially, it is a tuple of <code>parentNoteId</code> and <code>noteId</code>, indicating that the given note is placed as a child under the specified parent note.</p><p>Each note can have multiple branches, meaning any note can be placed in multiple locations within the tree. This concept is referred to as&nbsp;<a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a>.</p><h2>Prefix</h2><p>A prefix is a branch-specific title modifier for a note. If you place your note in two different locations within the tree and want to alter the title slightly in one of those placements, you can use a prefix.</p><p>To edit a prefix, right-click on the note in the tree pane and select <em>Edit branch prefix</em>.</p><p>The prefix is not part of the note itself and is not encrypted when the note is protected. This can be useful if you want part of the title to remain visible in the tree for easier navigation, even when the note is protected.</p><h2>Subtree</h2><p>A subtree consists of a particular note (the subtree root) and all its children and descendants. Some operations, such as exporting, work on entire subtrees.</p>",
"_help_MMiBEQljMQh2": "<p>One of the Trilium's goals is to provide fast and comfortable navigation between notes.</p><h2>Backwards and forward</h2><p>You can use alt-left and alt-right to move back and forward in history of viewed pages.</p><p>This works identically to browser backwards / forwards, it's actually using built-in browser support for this.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Navigation/Note%20Navigation_image.jpg\"></p><h2>Jump to note</h2><p>This is useful to quickly find and view arbitrary notes - click on <code>Jump to</code> button on the top or press <kbd>Ctrl</kbd> + <kbd>J</kbd> . Then type part of the note name and autocomplete will help you pick the desired note.</p><p>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_F1r9QtzQLZqm\">Jump to Note</a>&nbsp;for more information.</p>",
diff --git a/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note badges.md b/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note badges.md
index 4ab4a38919..ac25ab381d 100644
--- a/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note badges.md
+++ b/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note badges.md
@@ -9,5 +9,5 @@ The following badges are available:
* <span class="tn-icon bx bx-share-alt"></span> **Share badge**, which will indicate that the current note is shared. The badge will also indicate if the share is on the local network (for the desktop application without <a class="reference-link" href="../../Installation%20%26%20Setup/Synchronization.md">Synchronization</a> set up) or publicly accessible (for the server).
* <span class="tn-icon bx bx-globe"></span> **Web clip badge**, which will indicate if the note was clipped using the <a class="reference-link" href="../../Installation%20%26%20Setup/Web%20Clipper.md">Web Clipper</a>. The badge acts as a link, so it can be clicked on to navigate to the page or right clicked for more options. When the clipper also saved the page's description, its author, or the dates it was published and last updated, clicking the badge shows these details instead, with a link to the page at the top.
* <span class="tn-icon bx bx-play"></span> **Execute badge**, for [scripts](../../Scripting.md) or [saved SQL queries](../../Advanced%20Usage/Database/Manually%20altering%20the%20database/SQL%20Console.md) which have an execute button or a description.
-* <span class="tn-icon bx bx-copy-alt"></span> **Template badge**, for <a class="reference-link" href="../../Advanced%20Usage/Templates.md">Templates</a> (including workspace templates). Notes created from a template inherit its attributes, so the badge is a reminder that changing them affects every such note. Clicking the badge switches the template between being offered everywhere and only while hoisted into its workspace, the latter being available only for a template inside a workspace (see <a class="reference-link" href="../Navigation/Workspaces.md">Workspaces</a>).
+* <span class="tn-icon bx bx-copy-alt"></span> **Template badge**, for <a class="reference-link" href="../../Advanced%20Usage/Templates.md">Templates</a> (including workspace templates, for which the badge reads _Workspace template_). Notes created from a template inherit its attributes, so the badge is a reminder that changing them affects every such note. Clicking the badge switches the template between being offered everywhere and only while hoisted into its workspace, the latter being available only for a template inside a workspace (see <a class="reference-link" href="../Navigation/Workspaces.md">Workspaces</a>).
* For <a class="reference-link" href="../Active%20content.md">Active content</a> (e.g. scripts, styles), a dedicated badge will be shown indicating the type of note and with an option to easily enable or disable it.
\ No newline at end of file