From 9e43be6a07778b1b5e74d2b3a9872132509b8e47 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 15 Jul 2020 13:15:36 +0200 Subject: [PATCH] Documentation --- Customizations/TagRendering.ts | 49 ++++++++++++++++++--------- UI/SimpleAddUI.ts | 8 ++--- index.html | 4 +-- index.ts | 61 ++++++++++++++++++---------------- test.ts | 8 +++++ 5 files changed, 79 insertions(+), 51 deletions(-) diff --git a/Customizations/TagRendering.ts b/Customizations/TagRendering.ts index a02f2a0..c5f8d63 100644 --- a/Customizations/TagRendering.ts +++ b/Customizations/TagRendering.ts @@ -27,11 +27,7 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor { constructor(options: { - /** - * What is the priority of the question. - * By default, in the popup of a feature, only one question is shown at the same time. If multiple questions are unanswered, the question with the highest priority is asked first - */ - priority?: number + /** * This is the string that is shown in the popup if this tag is missing. @@ -42,17 +38,12 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor { question?: string, /** - * Optional: - * if defined, this a common piece of tag that is shown in front of every mapping (except freeform) + * What is the priority of the question. + * By default, in the popup of a feature, only one question is shown at the same time. If multiple questions are unanswered, the question with the highest priority is asked first */ - primer?: string, - tagsPreprocessor?: ((tags: any) => any), - freeform?: { - key: string, template: string, - renderTemplate: string - placeholder?: string, - extraTags?: TagsFilter, - }, + priority?: number, + + /** * Mappings convert a well-known tag combination into a user friendly text. * It converts e.g. 'access=yes' into 'this area can be accessed' @@ -65,7 +56,33 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor { * * */ - mappings?: { k: TagsFilter, txt: string, priority?: number, substitute?: boolean }[] + mappings?: { k: TagsFilter, txt: string, priority?: number, substitute?: boolean }[], + + + /** + * If one wants to render a freeform tag (thus no predefined key/values) or if there are a few well-known tags with a freeform object, + * use this. + * In the question, it'll offer a textfield + */ + freeform?: { + key: string, template: string, + renderTemplate: string + placeholder?: string, + extraTags?: TagsFilter, + }, + + + /** + * Optional: + * if defined, this a common piece of tag that is shown in front of every mapping (except freeform) + */ + primer?: string, + + /** + * In some very rare cases, tags have to be rewritten before displaying + * This function adds this + */ + tagsPreprocessor?: ((tags: any) => any) }) { this.options = options; } diff --git a/UI/SimpleAddUI.ts b/UI/SimpleAddUI.ts index 4deb4b3..b235437 100644 --- a/UI/SimpleAddUI.ts +++ b/UI/SimpleAddUI.ts @@ -63,6 +63,10 @@ export class SimpleAddUI extends UIElement { protected InnerRender(): string { const header = "

Geen selectie

" + "Je klikte ergens waar er nog geen gezochte data is.
"; + if (!this._userDetails.data.loggedIn) { + return header + "Gelieve je aan te melden om een nieuw punt toe te voegen" + } + if (this._zoomlevel.data.zoom < 19) { return header + "Zoom verder in om een element toe te voegen."; } @@ -71,10 +75,6 @@ export class SimpleAddUI extends UIElement { return header + "De data is nog aan het laden. Nog even geduld, dan kan je een punt toevoegen"; } - if (!this._userDetails.data.loggedIn) { - return header + "Gelieve je aan te melden om een nieuw punt toe te voegen" - } - var html = ""; for (const button of this._addButtons) { html += button.Render(); diff --git a/index.html b/index.html index 16c5387..a6fdedd 100644 --- a/index.html +++ b/index.html @@ -23,10 +23,10 @@
-