Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(calendar): list the calendar's settings in its properties dialog
Elian Doran6bfd274a25cb
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 8bce40bbe9..3cbf280555 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -3694,7 +3694,8 @@"new_template_name": "New event template","event_template": "Select an event template","more_templates": "More templates…",- "template": "Template"+ "template": "Template",+ "general": "General"},"ocr": {"extracted_text": "Extracted Text (OCR)",diff --git a/apps/client/src/widgets/collections/board/properties.css b/apps/client/src/widgets/collections/board/properties.cssdeleted file mode 100644index 781f9d6db9..0000000000--- a/apps/client/src/widgets/collections/board/properties.css+++ /dev/null@@ -1,8 +0,0 @@-/* The dialog stacks its cards, so the space between them is its own rather than each card's. */-.modal.board-properties-dialog .modal-body {- display: flex;- flex-direction: column;- gap: 24px;- padding-inline: 25px;- padding-block-end: 25px;-}diff --git a/apps/client/src/widgets/collections/board/properties.tsx b/apps/client/src/widgets/collections/board/properties.tsxindex 5dcf4ceec7..34a257e1cf 100644--- a/apps/client/src/widgets/collections/board/properties.tsx+++ b/apps/client/src/widgets/collections/board/properties.tsx@@ -1,16 +1,14 @@-import "./properties.css";-import { useCallback } from "preact/hooks";import type FNote from "../../../entities/fnote";import dialog from "../../../services/dialog";import { t } from "../../../services/i18n";import { isMobile } from "../../../services/utils";+import { CollectionPropertiesDialog } from "../../note_bars/CollectionProperties";import { Card, CardSection, OptionCardSection } from "../../react/Card";import FormSelect from "../../react/FormSelect";import FormToggle from "../../react/FormToggle";import { useNoteLabelBoolean, useNoteLabelWithDefault } from "../../react/hooks";-import Modal from "../../react/Modal";import PromotedAttributesCard from "../../react/PromotedAttributesCard";import TemplateSelectionCard from "../../react/TemplateSelectionCard";import type { PromotedAttribute } from "../promoted_attributes";@@ -34,11 +32,9 @@ export default function BoardProperties({ api, note, shown, onClose }: {(attributes: PromotedAttribute[]) => api.setPromotedAttributes(attributes), [ api ]);return (- <Modal+ <CollectionPropertiesDialogclassName="board-properties-dialog"title={t("board_view.properties-title")}- size="lg"- scrollableshow={shown}onHidden={onClose}>@@ -62,7 +58,7 @@ export default function BoardProperties({ api, note, shown, onClose }: {templates={api.getCardTemplateIds()}onChange={store}/>- </Modal>+ </CollectionPropertiesDialog>);}diff --git a/apps/client/src/widgets/collections/calendar/CalendarProperties.css b/apps/client/src/widgets/collections/calendar/CalendarProperties.cssdeleted file mode 100644index 7c36ce5877..0000000000--- a/apps/client/src/widgets/collections/calendar/CalendarProperties.css+++ /dev/null@@ -1,4 +0,0 @@-.modal.calendar-properties-dialog .modal-body {- padding-inline: 25px;- padding-block-end: 25px;-}diff --git a/apps/client/src/widgets/collections/calendar/CalendarProperties.spec.tsx b/apps/client/src/widgets/collections/calendar/CalendarProperties.spec.tsxindex a169cefd47..37e21ac584 100644--- a/apps/client/src/widgets/collections/calendar/CalendarProperties.spec.tsx+++ b/apps/client/src/widgets/collections/calendar/CalendarProperties.spec.tsx@@ -4,6 +4,7 @@ import { act } from "preact/test-utils";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import type FNote from "../../../entities/fnote";+import { buildNote } from "../../../test/easy-froca";import type { CalendarViewData } from "./api";import CalendarProperties from "./CalendarProperties";@@ -11,6 +12,11 @@ import CalendarProperties from "./CalendarProperties";vi.mock("../../../services/i18n", () => ({t: (key: string) => key}));+// The settings dropdown's definitions translate through i18next directly, at import.+vi.mock("i18next", async (importOriginal) => ({+ ...await importOriginal<typeof import("i18next")>(),+ t: (key: string) => key+}));/** What the stubbed card reports on the next click. */let reported: string[] = [];@@ -37,7 +43,7 @@ vi.mock("../../react/TemplateSelectionCard", () => ({describe("CalendarProperties", () => {let container: HTMLElement;let saved: CalendarViewData[];- const calendar = { noteId: "calendar1" } as FNote;+ const calendar = buildNote({ id: "calendar1", title: "Calendar" }) as unknown as FNote;function draw(viewConfig: CalendarViewData | undefined) {act(() => {@@ -90,6 +96,24 @@ describe("CalendarProperties", () => {expect(draw({ templates: [ "note:mine" ] })?.dataset.templates).toBe("note:mine");});+ it("repeats the settings dropdown's calendar settings in a General card, above the templates", () => {+ draw(undefined);+ const general = document.querySelector(".calendar-properties-dialog .calendar-properties-general");+ const titles = [ ...general?.querySelectorAll(".tn-card-option-title") ?? [] ]+ .map((title) => title.textContent);++ expect(titles).toEqual([+ "book_properties_config.hide-weekends",+ "book_properties_config.display-week-numbers",+ "calendar_view.time_slots",+ "calendar_view.slot_duration",+ "calendar_view.slot_label_interval",+ "book_properties.include_archived_notes"+ ]);+ expect(general?.compareDocumentPosition(document.querySelector(".templates-stub") as Node))+ .toBe(Node.DOCUMENT_POSITION_FOLLOWING);+ });+/** On a phone the new-event form is itself a dialog, opened before this one from its template field. */it("opens over the dialog already open rather than closing it", () => {const sheet = document.createElement("div");diff --git a/apps/client/src/widgets/collections/calendar/CalendarProperties.tsx b/apps/client/src/widgets/collections/calendar/CalendarProperties.tsxindex 99e7d8af74..e8eb4d0713 100644--- a/apps/client/src/widgets/collections/calendar/CalendarProperties.tsx+++ b/apps/client/src/widgets/collections/calendar/CalendarProperties.tsx@@ -1,15 +1,21 @@-import "./CalendarProperties.css";-import { useCallback } from "preact/hooks";import type FNote from "../../../entities/fnote";import { t } from "../../../services/i18n";-import Modal from "../../react/Modal";+import {+ CollectionPropertiesDialog, INCLUDE_ARCHIVED_PROPERTY+} from "../../note_bars/CollectionProperties";+import { bookPropertiesConfig } from "../../note_bars/collection-properties-config";+import { Card } from "../../react/Card";+import { ViewPropertySection } from "../../react/NotePropertyMenu";import TemplateSelectionCard from "../../react/TemplateSelectionCard";import { offeredTemplateIds } from "../../react/TemplateDropdown";import { type CalendarViewData, DEFAULT_EVENT_TEMPLATES } from "./api";-/** The calendar's settings that the collection properties bar does not hold. */+/**+ * The calendar's settings: those of the collection's settings dropdown, and the event templates,+ * which only this dialog holds.+ */export default function CalendarProperties({ note, viewConfig, saveConfig, onClose }: {/** The calendar note, which is the parent of any template created here. */note: FNote;@@ -25,15 +31,19 @@ export default function CalendarProperties({ note, viewConfig, saveConfig, onClo}, [ viewConfig, saveConfig ]);return (- <Modal+ <CollectionPropertiesDialogclassName="calendar-properties-dialog"title={t("calendar_view.properties")}- size="lg"- scrollableshowstackableonHidden={onClose}>+ <Card className="calendar-properties-general" heading={t("calendar_view.general")}>+ {GENERAL_PROPERTIES.map((property, index) => (+ <ViewPropertySection key={index} note={note} property={property} />+ ))}+ </Card>+<TemplateSelectionCardheading={t("calendar_view.event_templates")}instruction={t("calendar_view.event_templates_hint")}@@ -42,6 +52,11 @@ export default function CalendarProperties({ note, viewConfig, saveConfig, onClotemplates={offeredTemplateIds(viewConfig, DEFAULT_EVENT_TEMPLATES)}onChange={storeTemplates}/>- </Modal>+ </CollectionPropertiesDialog>);}++/** What the settings dropdown offers for a calendar, which the General card repeats. */+const GENERAL_PROPERTIES = [+ ...bookPropertiesConfig.calendar.properties, INCLUDE_ARCHIVED_PROPERTY+];diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsxindex 3435a450d3..211af2c9c6 100644--- a/apps/client/src/widgets/collections/calendar/index.tsx+++ b/apps/client/src/widgets/collections/calendar/index.tsx@@ -24,6 +24,7 @@ import { type NoteTypeOption } from "../../../services/note_types";import note_tooltip from "../../../services/note_tooltip";import { isMobile } from "../../../services/utils";import CollectionProperties from "../../note_bars/CollectionProperties";+import { DEFAULT_SLOT_DURATION, DEFAULT_SLOT_LABEL_INTERVAL } from "../../note_bars/collection-properties-config";import ActionButton from "../../react/ActionButton";import Button, { ButtonGroup } from "../../react/Button";import CollapseOnOverflow from "../../react/CollapseOnOverflow";@@ -81,9 +82,6 @@ const CALENDAR_VIEWS = [const SUPPORTED_CALENDAR_VIEW_TYPE = CALENDAR_VIEWS.map(v => v.type);-const DEFAULT_SLOT_DURATION = "00:15:00";-const DEFAULT_SLOT_LABEL_INTERVAL = "01:00:00";-// Here we hard-code the imports in order to ensure that they are embedded by webpack without having to load all the languages.export const LOCALE_MAPPINGS: Record<DISPLAYABLE_LOCALE_IDS, (() => Promise<{ default: LocaleInput }>) | null> = {de: () => import("fullcalendar/locales/de"),diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.css b/apps/client/src/widgets/note_bars/CollectionProperties.cssindex 364e3379df..312a48a64f 100644--- a/apps/client/src/widgets/note_bars/CollectionProperties.css+++ b/apps/client/src/widgets/note_bars/CollectionProperties.css@@ -43,3 +43,11 @@}}}++.modal.collection-properties-dialog .modal-body {+ display: flex;+ flex-direction: column;+ gap: 24px;+ padding-inline: 25px;+ padding-block-end: 25px;+}diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.tsx b/apps/client/src/widgets/note_bars/CollectionProperties.tsxindex fd659f29ab..911e2df94d 100644--- a/apps/client/src/widgets/note_bars/CollectionProperties.tsx+++ b/apps/client/src/widgets/note_bars/CollectionProperties.tsx@@ -1,6 +1,7 @@import "./CollectionProperties.css";import { SearchResultDetails, SearchResultDetailsResponse } from "@triliumnext/commons";+import clsx from "clsx";import { t } from "i18next";import { ComponentChildren } from "preact";import { useRef, useState } from "preact/hooks";@@ -18,6 +19,7 @@ import Dropdown from "../react/Dropdown";import { FormDropdownDivider, FormListItem } from "../react/FormList";import { useNoteContext, useNoteLabel, useNoteProperty, useTriliumEvent } from "../react/hooks";import Icon from "../react/Icon";+import Modal from "../react/Modal";import { CheckBoxProperty, ViewProperty } from "../react/NotePropertyMenu";import { bookPropertiesConfig } from "./collection-properties-config";@@ -45,6 +47,14 @@ export const VIEW_TYPE_MAPPINGS: Record<ViewTypeOptions, string> = {const MAX_OPEN_TABS = 50;+/** Whether a collection shows its archived notes, which every view offers. */+export const INCLUDE_ARCHIVED_PROPERTY: CheckBoxProperty = {+ type: "checkbox",+ icon: "bx bx-archive",+ label: t("book_properties.include_archived_notes"),+ bindToLabel: "includeArchived"+};+interface CollectionPropertiesProps {note: FNote;centerChildren?: ComponentChildren;@@ -223,12 +233,7 @@ function ViewOptions({ note, viewType, optionsChildren }: {bindToLabel: "subtreeHidden"} as CheckBoxProperty} />- <ViewProperty note={note} property={{- type: "checkbox",- icon: "bx bx-archive",- label: t("book_properties.include_archived_notes"),- bindToLabel: "includeArchived"- } as CheckBoxProperty} />+ <ViewProperty note={note} property={INCLUDE_ARCHIVED_PROPERTY} />{optionsChildren && <><FormDropdownDivider />@@ -237,3 +242,31 @@ function ViewOptions({ note, viewType, optionsChildren }: {</Dropdown>);}++/**+ * The dialog holding a collection's settings beyond its bar, such as its templates, as a column of+ * cards.+ */+export function CollectionPropertiesDialog({ className, title, show, stackable, onHidden, children }: {+ className: string;+ title: string;+ show: boolean;+ /** Opens over a dialog already shown, such as the new-event sheet on a phone. */+ stackable?: boolean;+ onHidden: () => void;+ children: ComponentChildren;+}) {+ return (+ <Modal+ className={clsx("collection-properties-dialog", className)}+ title={title}+ size="lg"+ scrollable+ show={show}+ stackable={stackable}+ onHidden={onHidden}+ >+ {children}+ </Modal>+ );+}diff --git a/apps/client/src/widgets/note_bars/collection-properties-config.tsx b/apps/client/src/widgets/note_bars/collection-properties-config.tsxindex 3eb9604a59..fe1bfc9711 100644--- a/apps/client/src/widgets/note_bars/collection-properties-config.tsx+++ b/apps/client/src/widgets/note_bars/collection-properties-config.tsx@@ -10,6 +10,11 @@ import { FormDropdownDivider, FormListItem } from "../react/FormList";import { useNoteLabel } from "../react/hooks";import { BookProperty, ClickContext, ComboBoxItem } from "../react/NotePropertyMenu";+/** How long a row of the calendar's day and week views lasts, until `#calendar:slotDuration` says. */+export const DEFAULT_SLOT_DURATION = "00:15:00";+/** How often those views label their rows, until `#calendar:slotLabelInterval` says. */+export const DEFAULT_SLOT_LABEL_INTERVAL = "01:00:00";+interface BookConfig {properties: BookProperty[];}@@ -71,6 +76,7 @@ export const bookPropertiesConfig: Record<ViewTypeOptions, BookConfig> = {label: t("calendar_view.slot_duration"),type: "option-group",bindToLabel: "calendar:slotDuration",+ defaultValue: DEFAULT_SLOT_DURATION,options: slotDurationOptions([5, 10, 15, 20, 30, 60])},{ type: "separator" },@@ -78,6 +84,7 @@ export const bookPropertiesConfig: Record<ViewTypeOptions, BookConfig> = {label: t("calendar_view.slot_label_interval"),type: "option-group",bindToLabel: "calendar:slotLabelInterval",+ defaultValue: DEFAULT_SLOT_LABEL_INTERVAL,// Labels want to be coarser than the slots themselves.options: slotDurationOptions([15, 30, 60])}diff --git a/apps/client/src/widgets/react/NotePropertyMenu.spec.tsx b/apps/client/src/widgets/react/NotePropertyMenu.spec.tsxindex 9a24774c98..45cf5c9590 100644--- a/apps/client/src/widgets/react/NotePropertyMenu.spec.tsx+++ b/apps/client/src/widgets/react/NotePropertyMenu.spec.tsx@@ -1,10 +1,11 @@import { render } from "preact";import { act } from "preact/test-utils";-import { afterEach, describe, expect, it } from "vitest";+import { afterEach, describe, expect, it, vi } from "vitest";-import { buildNote } from "../../test/easy-froca";import type FNote from "../../entities/fnote";-import { ViewProperty } from "./NotePropertyMenu";+import attributes from "../../services/attributes";+import { buildNote } from "../../test/easy-froca";+import { type BookProperty, ViewProperty, ViewPropertySection } from "./NotePropertyMenu";describe("A collection property's explanation", () => {let container: HTMLElement | undefined;@@ -71,3 +72,77 @@ describe("A collection property's explanation", () => {expect(element.querySelector(".help-tooltip-button")).not.toBeNull();});});++describe("ViewPropertySection", () => {+ let container: HTMLElement | undefined;++ afterEach(() => {+ if (container) {+ render(null, container);+ container.remove();+ container = undefined;+ }+ vi.restoreAllMocks();+ });++ function draw(note: FNote, properties: BookProperty[]) {+ const element = document.createElement("div");+ container = element;+ document.body.appendChild(element);+ act(() => {+ render(<>{properties.map((property, index) => (+ <ViewPropertySection key={index} note={note} property={property} />+ ))}</>, element);+ });+ return element;+ }++ const titles = (element: HTMLElement) => [ ...element.querySelectorAll(".tn-card-option-title") ]+ .map((title) => title.textContent);++ it("draws a switch, an option group and a submenu as card rows, and nothing for a button", () => {+ const note = buildNote({ title: "Calendar", "#calendar:weekNumbers": "true" }) as unknown as FNote;+ const element = draw(note, [+ { type: "checkbox", label: "Week numbers", bindToLabel: "calendar:weekNumbers" },+ { type: "button", label: "Collapse", onClick() {} },+ {+ type: "submenu", label: "Time slots", children: [+ {+ type: "option-group", label: "Duration", bindToLabel: "calendar:slotDuration",+ defaultValue: "00:30:00",+ options: [ { value: "00:15:00", label: "15 min" }, { value: "00:30:00", label: "30 min" } ]+ },+ { type: "separator" }+ ]+ }+ ]);++ expect(titles(element)).toEqual([ "Week numbers", "Time slots", "Duration" ]);+ expect(element.querySelector(".switch-button")?.classList.contains("on")).toBe(true);+ // The submenu's options stand nested under its own row, showing the default while unset.+ const select = element.querySelector<HTMLSelectElement>(".tn-card-section-nested select");+ expect(select?.value).toBe("00:30:00");+ });++ it("writes the label it is bound to", () => {+ const setLabel = vi.spyOn(attributes, "setLabel").mockResolvedValue(undefined);+ const setBoolean = vi.spyOn(attributes, "setBooleanWithInheritance").mockResolvedValue(undefined);+ const note = buildNote({ title: "Calendar" }) as unknown as FNote;+ const element = draw(note, [+ { type: "checkbox", label: "Hide weekends", bindToLabel: "calendar:hideWeekends" },+ {+ type: "option-group", label: "Duration", bindToLabel: "calendar:slotDuration",+ options: [ { value: "00:15:00", label: "15 min" }, { value: "00:30:00", label: "30 min" } ]+ }+ ]);++ act(() => element.querySelector<HTMLElement>(".switch-button")?.click());+ expect(setBoolean).toHaveBeenCalledWith(note, "calendar:hideWeekends", true);++ const select = element.querySelector<HTMLSelectElement>("select");+ if (!select) throw new Error("The option group has no select.");+ select.value = "00:30:00";+ act(() => { select.dispatchEvent(new Event("change", { bubbles: true })); });+ expect(setLabel).toHaveBeenCalledWith(note.noteId, "calendar:slotDuration", "00:30:00");+ });+});diff --git a/apps/client/src/widgets/react/NotePropertyMenu.tsx b/apps/client/src/widgets/react/NotePropertyMenu.tsxindex 618993ccd1..cb4a3624b3 100644--- a/apps/client/src/widgets/react/NotePropertyMenu.tsx+++ b/apps/client/src/widgets/react/NotePropertyMenu.tsx@@ -5,7 +5,10 @@ import { useContext } from "preact/hooks";import Component from "../../components/component";import FNote from "../../entities/fnote";import NoteContextAwareWidget from "../note_context_aware_widget";+import { OptionCardSection } from "./Card";import { FormDropdownDivider, FormDropdownSubmenu, FormListItem, FormListToggleableItem } from "./FormList";+import FormSelect from "./FormSelect";+import FormToggle from "./FormToggle";import HelpTooltipButton from "./HelpTooltipButton";import FormTextBox from "./FormTextBox";import { useNoteLabel, useNoteLabelBoolean } from "./hooks";@@ -150,6 +153,33 @@ export function ViewProperty({ note, property }: { note: FNote, property: BookPr}}+/**+ * A property as a row of a settings card, for a dialog that offers what the collection's settings+ * dropdown does. Covers switches, option groups and the submenus holding them; buttons and the+ * other kinds that only make sense in a menu render nothing.+ */+export function ViewPropertySection({ note, property }: { note: FNote, property: BookProperty }) {+ switch (property.type) {+ case "checkbox":+ return <CheckBoxPropertySection note={note} property={property} />;+ case "option-group":+ return <OptionGroupPropertySection note={note} property={property} />;+ case "submenu":+ return (+ <OptionCardSection+ label={property.label}+ description={property.helpTooltip}+ subSectionsVisible+ subSections={property.children.map((child, index) => (+ <ViewPropertySection key={index} note={note} property={child} />+ ))}+ />+ );+ default:+ return null;+ }+}+function SubmenuPropertyView({ note, property }: { note: FNote, property: SubmenuProperty }) {return (<FormDropdownSubmenu@@ -305,3 +335,40 @@ function CheckBoxPropertyView({ note, property }: { note: FNote, property: Check/>);}++function CheckBoxPropertySection({ note, property }: { note: FNote, property: CheckBoxProperty }) {+ const [ value, setValue ] = useNoteLabelBoolean(note, property.bindToLabel);+ return (+ <OptionCardSection+ name={property.bindToLabel}+ label={property.label}+ description={property.helpTooltip}+ >+ <FormToggle+ currentValue={property.reverseValue ? !value : value}+ onChange={(newValue) => setValue(property.reverseValue ? !newValue : newValue)}+ />+ </OptionCardSection>+ );+}++function OptionGroupPropertySection({ note, property }: {+ note: FNote, property: OptionGroupProperty & PropertyHelp+}) {+ const [ value, setValue ] = useNoteLabel(note, property.bindToLabel);+ return (+ <OptionCardSection+ name={property.bindToLabel}+ label={property.label}+ description={property.helpTooltip}+ >+ <FormSelect+ values={property.options}+ keyProperty="value"+ titleProperty="label"+ currentValue={value ?? property.defaultValue ?? undefined}+ onChange={setValue}+ />+ </OptionCardSection>+ );+}diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Calendar.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Calendar.htmlindex c9bd1e2975..bd402a5d1c 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Calendar.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Calendar.html@@ -153,6 +153,10 @@<li>Set the slot label interval (how often time labels appear on the axisin day/week view).</li></ul>+<p>The same settings, together with whether archived notes are shown, are+ also listed under <em>General</em> in the <span class="tn-icon bx bx-cog"></span> <em>Calendar properties</em> dialog+ (see <a href="#event-templates">Event templates</a> for how to open it).+ The time slots are listed there whichever view the calendar is in.</p><h3>Event templates</h3><p>By default, a new event is a <a class="reference-link" href="#root/_help_iPIMuisry3hd">Text</a> note.To make events from other note types, or from <a class="reference-link"diff --git a/docs/User Guide/User Guide/Collections/Calendar.md b/docs/User Guide/User Guide/Collections/Calendar.mdindex 3d412b5ad8..af7bf0e27a 100644--- a/docs/User Guide/User Guide/Collections/Calendar.md+++ b/docs/User Guide/User Guide/Collections/Calendar.md@@ -97,6 +97,8 @@ In the <a class="reference-link" href="Collection%20Properties.md">Collection P* Set the slot duration (the length of each time row in day/week view).* Set the slot label interval (how often time labels appear on the axis in day/week view).+The same settings, together with whether archived notes are shown, are also listed under _General_ in the <span class="tn-icon bx bx-cog"></span> _Calendar properties_ dialog (see [Event templates](#event-templates) for how to open it). The time slots are listed there whichever view the calendar is in.+### Event templatesBy default, a new event is a <a class="reference-link" href="../Note%20Types/Text.md">Text</a> note. To make events from other note types, or from <a class="reference-link" href="../Advanced%20Usage/Templates.md">Templates</a> with predefined content and attributes (such as a color), open the <span class="tn-icon bx bx-cog"></span> _Calendar properties_ dialog from the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20menu.md">Note menu</a> or from the settings menu of the <a class="reference-link" href="Collection%20Properties.md">Collection Properties</a>, and find _Event templates_. Here you can: