From 51d38e3354bd7eb91aabe5165c9c014df3337d1f Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 29 Jul 2020 20:09:25 +0200 Subject: [PATCH] Fix website quest --- Customizations/Questions/Website.ts | 4 ++-- InitUiElements.ts | 2 +- UI/MoreScreen.ts | 7 ++++++- test.ts | 24 ++++++++++++++++++++++-- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Customizations/Questions/Website.ts b/Customizations/Questions/Website.ts index 34051d343..ac0b67cd1 100644 --- a/Customizations/Questions/Website.ts +++ b/Customizations/Questions/Website.ts @@ -9,8 +9,8 @@ export default class Website extends TagRenderingOptions { question: Translations.t.general.questions.websiteOf.Subs({category: category}), freeform: { renderTemplate: Translations.t.general.questions.websiteIs, - template: "$phone$", - key: "phone" + template: "website", + key: "website" } }); } diff --git a/InitUiElements.ts b/InitUiElements.ts index e1084cafb..e2b543722 100644 --- a/InitUiElements.ts +++ b/InitUiElements.ts @@ -39,7 +39,7 @@ export class InitUiElements { {header: ``, content: welcome}, {header: ``, content: Translations.t.general.openStreetMapIntro}, {header: ``, content: new ShareScreen(layoutToUse, bm.Location)}, - {header: ``, content: new MoreScreen(bm.Location)} + {header: ``, content: new MoreScreen(layoutToUse.name, bm.Location)} ]) return fullOptions; diff --git a/UI/MoreScreen.ts b/UI/MoreScreen.ts index f4f8dbded..58764fa05 100644 --- a/UI/MoreScreen.ts +++ b/UI/MoreScreen.ts @@ -13,9 +13,11 @@ import {SubtleButton} from "./Base/SubtleButton"; export class MoreScreen extends UIElement { private currentLocation: UIEventSource<{ zoom: number, lat: number, lon: number }>; + private currentLayout: string; - constructor(currentLocation: UIEventSource<{ zoom: number, lat: number, lon: number }>) { + constructor(currentLayout: string, currentLocation: UIEventSource<{ zoom: number, lat: number, lon: number }>) { super(currentLocation); + this.currentLayout = currentLayout; this.currentLocation = currentLocation; } @@ -28,6 +30,9 @@ export class MoreScreen extends UIElement { if (layout.hideFromOverview) { continue } + if (layout.name === this.currentLayout) { + continue; + } const linkText = `https://pietervdvn.github.io/MapComplete/${layout.name}.html?z=${this.currentLocation.data.zoom}&lat=${this.currentLocation.data.lat}&lon=${this.currentLocation.data.lon}` diff --git a/test.ts b/test.ts index 0d6802345..dbf2fdfd1 100644 --- a/test.ts +++ b/test.ts @@ -1,4 +1,24 @@ -import {MoreScreen} from "./UI/MoreScreen"; +import {FeatureInfoBox} from "./UI/FeatureInfoBox"; +import {TagRenderingOptions} from "./Customizations/TagRendering"; +import {Changes} from "./Logic/Changes"; import {UIEventSource} from "./UI/UIEventSource"; +import {OsmConnection} from "./Logic/OsmConnection"; +import {ElementStorage} from "./Logic/ElementStorage"; +import {Tag} from "./Logic/TagsFilter"; +import FixedText from "./Customizations/Questions/FixedText"; +import {FixedUiElement} from "./UI/Base/FixedUiElement"; -new MoreScreen(new UIEventSource<{zoom: number, lat: number, lon: number}>({zoom: 16, lat: 51.3, lon: 3.2})).AttachTo("maindiv") \ No newline at end of file +const osm = new OsmConnection(true); +const changes = new Changes("test", osm, new ElementStorage()); + +const tags = new UIEventSource({name: "ESCAPEE

"}); +const x = new TagRenderingOptions( + { + mappings: [ + {k: null, txt: "Test: {name}"} + ] + } +); + +new FeatureInfoBox(undefined, tags, new FixedText(new FixedUiElement("{name}")), [x], changes, osm.userDetails) + .AttachTo("maindiv"); \ No newline at end of file