Skip to content

Build your personal knowledge base with Trilium Notes

client/note type chooser: add support for badges

Adorian Doran1af8edfe4d9e
diff --git a/apps/client/src/widgets/dialogs/note_type_chooser.ts b/apps/client/src/widgets/dialogs/note_type_chooser.ts
index 02b9603081..34a89aff60 100644
--- a/apps/client/src/widgets/dialogs/note_type_chooser.ts
+++ b/apps/client/src/widgets/dialogs/note_type_chooser.ts
@@ -154,13 +154,21 @@ export default class NoteTypeChooserDialog extends BasicWidget {
this.$noteTypeDropdown.append($('<h6 class="dropdown-header">').append(t("note_type_chooser.templates")));
} else {
const commandItem = noteType as MenuCommandItem<CommandNames>;
- this.$noteTypeDropdown.append(
- $('<a class="dropdown-item" tabindex="0">')
- .attr("data-note-type", commandItem.type || "")
- .attr("data-template-note-id", commandItem.templateNoteId || "")
- .append($("<span>").addClass(commandItem.uiIcon || ""))
- .append(` ${noteType.title}`)
- );
+ const listItem = $('<a class="dropdown-item" tabindex="0">')
+ .attr("data-note-type", commandItem.type || "")
+ .attr("data-template-note-id", commandItem.templateNoteId || "")
+ .append($("<span>").addClass(commandItem.uiIcon || ""))
+ .append(` ${noteType.title}`);
+
+ if (commandItem.badges) {
+ for (let badge of commandItem.badges) {
+ listItem.append($(`<span class="badge">`)
+ .addClass(badge.className || "")
+ .text(badge.title));
+ }
+ }
+
+ this.$noteTypeDropdown.append(listItem);
}
}