From c763cdb23f72f1292bbb8dcd70b8f3a07390c9d2 Mon Sep 17 00:00:00 2001 From: jomo Date: Fri, 5 Aug 2022 22:05:51 +0200 Subject: [PATCH] show known types in form --- static/form.html | 1 + static/form.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/static/form.html b/static/form.html index 5f87da3..4262383 100644 --- a/static/form.html +++ b/static/form.html @@ -30,6 +30,7 @@ +

diff --git a/static/form.js b/static/form.js index 2138949..b9dca54 100644 --- a/static/form.js +++ b/static/form.js @@ -12,6 +12,7 @@ document.onreadystatechange = function() { function fillForm() { const item = items[id]; + knownTypes(); const is_in = document.getElementById('is_in'); @@ -52,6 +53,17 @@ function fillForm() { } } +function knownTypes() { + let map = {}; + for (const i of Object.values(items)) { + if (i.type) { + map[i.type] = true; + } + } + let types = Object.keys(map).sort().join(', ') + document.getElementById('knowntypes').textContent = `Known types: ${types}.`; +} + function save() { item = { id: document.getElementById('id').value || null,