Fix website quest

This commit is contained in:
Pieter Vander Vennet 2020-07-29 20:09:25 +02:00
parent ca391e948d
commit 51d38e3354
4 changed files with 31 additions and 6 deletions

View file

@ -9,8 +9,8 @@ export default class Website extends TagRenderingOptions {
question: Translations.t.general.questions.websiteOf.Subs({category: category}), question: Translations.t.general.questions.websiteOf.Subs({category: category}),
freeform: { freeform: {
renderTemplate: Translations.t.general.questions.websiteIs, renderTemplate: Translations.t.general.questions.websiteIs,
template: "$phone$", template: "website",
key: "phone" key: "website"
} }
}); });
} }

View file

@ -39,7 +39,7 @@ export class InitUiElements {
{header: `<img src='${layoutToUse.icon}'>`, content: welcome}, {header: `<img src='${layoutToUse.icon}'>`, content: welcome},
{header: `<img src='${'./assets/osm-logo.svg'}'>`, content: Translations.t.general.openStreetMapIntro}, {header: `<img src='${'./assets/osm-logo.svg'}'>`, content: Translations.t.general.openStreetMapIntro},
{header: `<img src='${'./assets/share.svg'}'>`, content: new ShareScreen(layoutToUse, bm.Location)}, {header: `<img src='${'./assets/share.svg'}'>`, content: new ShareScreen(layoutToUse, bm.Location)},
{header: `<img src='${'./assets/add.svg'}'>`, content: new MoreScreen(bm.Location)} {header: `<img src='${'./assets/add.svg'}'>`, content: new MoreScreen(layoutToUse.name, bm.Location)}
]) ])
return fullOptions; return fullOptions;

View file

@ -13,9 +13,11 @@ import {SubtleButton} from "./Base/SubtleButton";
export class MoreScreen extends UIElement { export class MoreScreen extends UIElement {
private currentLocation: UIEventSource<{ zoom: number, lat: number, lon: number }>; 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); super(currentLocation);
this.currentLayout = currentLayout;
this.currentLocation = currentLocation; this.currentLocation = currentLocation;
} }
@ -28,6 +30,9 @@ export class MoreScreen extends UIElement {
if (layout.hideFromOverview) { if (layout.hideFromOverview) {
continue continue
} }
if (layout.name === this.currentLayout) {
continue;
}
const linkText = 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}` `https://pietervdvn.github.io/MapComplete/${layout.name}.html?z=${this.currentLocation.data.zoom}&lat=${this.currentLocation.data.lat}&lon=${this.currentLocation.data.lon}`

24
test.ts
View file

@ -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 {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") const osm = new OsmConnection(true);
const changes = new Changes("test", osm, new ElementStorage());
const tags = new UIEventSource<any>({name: "<b>ESCAPEE <h3>"});
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");