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(attributes): let any definition carry a display name
Elian Doran6f3f631011f0
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex cbc2e77747..0835b451dd 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -528,8 +528,7 @@"target_note": "Target note","promoted_title": "Shown as an editable field on every note that has this attribute.","promoted": "Promoted",- "promoted_alias_title": "Name shown on the promoted field.",- "promoted_alias": "Alias",+ "promoted_alias": "Display name","multiplicity_title": "Lets a note carry this attribute more than once.","multiplicity": "Multiple values","single_value": "Single value",diff --git a/apps/client/src/widgets/attribute_widgets/attribute_detail.tsx b/apps/client/src/widgets/attribute_widgets/attribute_detail.tsxindex 64f287ed46..72a78d28f9 100644--- a/apps/client/src/widgets/attribute_widgets/attribute_detail.tsx+++ b/apps/client/src/widgets/attribute_widgets/attribute_detail.tsx@@ -527,12 +527,20 @@ function AttributeForm({ opts, attrType: initialAttrType, currentNoteId, onCance</OptionsRow>)}- {/*- * What is filled in comes first, what is switched on after it, so that the toggles read as- * one block rather than as interruptions between the fields. Promotion comes last of the- * three, its alias being a field that only exists while it is on: anywhere else in the- * block, turning promotion on would push a field in between the toggles.- */}+ {/* No description: what a display name is needs no explaining. */}+ {isDefinition(attrType) && (+ <OptionsRow name="attr-promoted-alias" label={t("attribute_detail.promoted_alias")}>+ <FormTextBox+ className="attr-input-promoted-alias"+ currentValue={definition.promotedAlias ?? ""}+ disabled={!isOwned}+ onChange={(promotedAlias) => commitDefinition({ promotedAlias })}+ />+ </OptionsRow>+ )}++ {/* What is filled in comes first, what is switched on after it, so that the toggles read+ as one block rather than as interruptions between the fields. */}{isDefinition(attrType) && !opts.hideMultiplicity && (<OptionsRowWithTogglename="attr-multiplicity"@@ -568,20 +576,6 @@ function AttributeForm({ opts, attrType: initialAttrType, currentNoteId, onCance/>)}- {isDefinition(attrType) && definition.isPromoted && (- <OptionsRow- name="attr-promoted-alias"- label={t("attribute_detail.promoted_alias")}- description={t("attribute_detail.promoted_alias_title")}- >- <FormTextBox- className="attr-input-promoted-alias"- currentValue={definition.promotedAlias ?? ""}- disabled={!isOwned}- onChange={(promotedAlias) => commitDefinition({ promotedAlias })}- />- </OptionsRow>- )}</div>{isOwned && (