From b44c523845df675396866fa39ef591b1561b470e Mon Sep 17 00:00:00 2001 From: azivner Date: Mon, 6 Aug 2018 14:43:42 +0200 Subject: [PATCH] basic support for saving promoted attributes --- .../javascripts/services/note_detail.js | 59 ++++++++++++++----- src/public/stylesheets/style.css | 5 ++ src/routes/api/attributes.js | 26 ++++++++ src/routes/routes.js | 1 + src/views/index.ejs | 2 +- 5 files changed, 78 insertions(+), 15 deletions(-) diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js index c99fcbe00..f02d0f467 100644 --- a/src/public/javascripts/services/note_detail.js +++ b/src/public/javascripts/services/note_detail.js @@ -34,7 +34,7 @@ const $relationList = $("#relation-list"); const $relationListInner = $("#relation-list-inner"); const $childrenOverview = $("#children-overview"); const $scriptArea = $("#note-detail-script-area"); -const $promotedAttributes = $("#note-detail-promoted-attributes"); +const $promotedAttributesContainer = $("#note-detail-promoted-attributes"); let currentNote = null; @@ -226,7 +226,7 @@ async function showChildrenOverview(hideChildrenOverview) { } async function loadAttributes() { - $promotedAttributes.empty(); + $promotedAttributesContainer.empty(); const noteId = getCurrentNoteId(); @@ -237,20 +237,38 @@ async function loadAttributes() { let idx = 1; if (promoted.length > 0) { - for (const promotedAttr of promoted) { - if (promotedAttr.type === 'label-definition') { - const inputId = "promoted-input-" + idx; - const $div = $("
").addClass("class", "form-group"); - const $label = $("