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
implemented date promoted attribute
azivner21551d7b7719
diff --git a/src/public/javascripts/dialogs/attributes.js b/src/public/javascripts/dialogs/attributes.jsindex 694f0b2a89..6fe6fc18b1 100644--- a/src/public/javascripts/dialogs/attributes.js+++ b/src/public/javascripts/dialogs/attributes.js@@ -26,8 +26,7 @@ function AttributesModel() {{ text: "Text", value: "text" },{ text: "Number", value: "number" },{ text: "Boolean", value: "boolean" },- { text: "Date", value: "date" },- { text: "DateTime", value: "datetime" }+ { text: "Date", value: "date" }];this.multiplicityTypes = [diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.jsindex 39e5fbe16a..a869b3f10e 100644--- a/src/public/javascripts/services/note_detail.js+++ b/src/public/javascripts/services/note_detail.js@@ -254,7 +254,7 @@ async function loadAttributes() {}for (const valueAttr of valueAttrs) {- const inputId = "promoted-input-" + idx;+ const inputId = "promoted-input-" + (idx++);const $tr = $("<tr>");const $labelCell = $("<th>").append(valueAttr.name);const $input = $("<input>")@@ -268,6 +268,10 @@ async function loadAttributes() {const $inputCell = $("<td>").append($input);+ $tr.append($labelCell).append($inputCell);++ $promotedAttributesContainer.append($tr);+if (valueAttr.type === 'label') {if (definition.labelType === 'text') {$input.prop("type", "text");@@ -282,19 +286,26 @@ async function loadAttributes() {$input.prop("checked", "checked");}}- else if (definitionAttr.labelType === 'date') {+ else if (definition.labelType === 'date') {$input.prop("type", "text");- $input.addClass("date");++ $input.datepicker({+ changeMonth: true,+ changeYear: true,+ dateFormat: "yy-mm-dd"+ });++ const $todayButton = $("<button>").text("Today").click(() => {+ $input.val(utils.formatDateISO(new Date()));+ $input.trigger("change");+ });++ $tr.append($("<tr>").append($todayButton));}- else if (definitionAttr.labelType === 'datetime') {- $input.prop("type", "text");- $input.addClass("datetime");+ else {+ messagingService.logError("Unknown labelType=" + definitionAttr.labelType);}}-- $tr.append($labelCell).append($inputCell);-- $promotedAttributesContainer.append($tr);}}}